Bring the naming of libraries and executable up to current standards.
[wine] / tools / wineinstall
1 #!/bin/bash
2 # WINE Installation script
3 # Can do almost everything from compiling to configuring...
4 #
5 # Copyright 1999 Ove Kåven
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 #
21 # History:
22 # Mar 31 1999 - Ove Kåven
23 #  First version
24 # Dec 9 1999 - Ove Kåven
25 #  require Xpm
26 # Feb 25 2000 - Ove Kåven
27 #  auto-add /usr/local/lib to /etc/ld.so.conf
28 # Mar 2 2000 - Ove Kåven
29 #  source rather than grep config.cache
30 #  use sourced config.cache to start ldconfig
31 #  reconfigure if config.cache doesn't exist
32 # Mar 30 2000 - Ove Kåven
33 #  autoconfigure no-windows installs
34 #  do not install registry on real-windows installs
35 #  some support for binary package installs
36 #  set and tell user about LD_LIBRARY_PATH if necessary
37 #  set EXTRA_LD_LIBRARY_PATH in wine.conf
38 # Apr 9 2000 - Ove Kåven
39 #  make root's registry global (system-default)
40 # May 9 2000 - Ove Kåven
41 #  use ttydrv when running regapi, so we don't have to run from X
42 #  change debugger path in registry
43 # Oct 29 2000 - Ove Kåven
44 #  added --enable-opengl to default confargs
45 #  added conf_question, conf_yesno_answer, and conf_string_answer functions
46 #  added DEFCAT variable
47 # (later that day...)
48 #  added conf_reset_question function
49 #  added file existence checks to the registry copying
50 #  fixed problem with no-windows directory creation
51 #  some text reformatting from Eric Maryniak
52 # Jan 5 2000 - Chris Morgan
53 #  use default config file in /documentation/samples/config
54 #  replace .winerc with ~/.wine/config in printed text
55 #  added user question to convert .winerc file(if exists) or use the default
56 #    config file
57 #  add conf_question to allow root to install a local config file and
58 #    registry
59 # Jan 12 2000 - Chris Morgan
60 #  distinguish between creating local and global config files
61 #  display a message about the status of global config files
62 #  misc cleanups and reordering of questions
63 #  added check to see if wine is installed when we are running as a normal
64 #    user and print a message if wine cannot be found
65 # Feb 16 2002 - Adam D. Moss
66 #  Use config.status instead of config.cache to check whether we're
67 #    configured/compiled and to recreate the configuration
68 # Feb 20 2002 - Adam D. Moss
69 #  Partially revert previous changes, force configure to write an
70 #    old-style config.cache
71 # Mar 27 2002 - Chris Morgan
72 #  prevent the user from running wineinstall as root
73 #  add script commands so we su root for 'make install' and other commands
74 #    that require root access
75 #  add text to tell the user we need to run stuff as root so they don't
76 #    think we are trying to pull something funny
77 # Apr 14 2002 - Dustin Navea
78 #  Fix sed command when finding real-windows registry so it actually
79 #   accesses a file (~/.wine/config) instead of null ($CONF?!)
80 #  Added search for clean-install (not upgrade) Win2k registry
81 #  (next day, after some sleep)
82 #  Fix sed string when finding real-windows registry to actually find
83 #   windows partition name in [Drive C] section
84 #  it should now almost always find the windows partition and real-windows
85 #  registry (if not, let me know)
86 # Aug 29 2002 - Rok Mandeljc <rok.mandeljc@gimb.org>
87 #  -added two symlinks; windows/winhelp.exe and windows/winhlp32.exe because it seems
88 #   that some apps look for winhlp32.exe/winhelp to display help
89 #
90
91 #--- defaults (change these if you are a packager)
92 CONFARGS="--enable-opengl"    # configure args, e.g. --prefix=/usr --sysconfdir=/etc
93 prefix=/usr/local             # installation prefix
94 sysconfdir=$prefix/etc        # where wine.conf and the global registry are supposed to be
95 bindir=$prefix/bin            # where winelib apps will be (or are) installed
96 libdir=$prefix/lib            # where libwine.so will be (or is) installed
97 exdir=documentation/samples   # where the sample system.ini resides
98 GCONF=$sysconfdir/wine.conf   # default path of the wine.conf global config file
99 LCONF=~/.wine/config          # default path of the local config file
100 BINDIST=no                    # whether called from a binary package config script
101 DOGLOBALCONF=auto             # whether to autogenerate wine.conf
102 DOLOCALCONF=auto              # whether to autogenerate localconf
103 DOWCHK=auto                   # whether to autoconfigure existing-windows installation
104 DOWINE=auto                   # whether to autoconfigure no-windows installation
105 DOREG=auto                    # whether to install default registry
106 DOAPP=auto                    # whether to install applications, distributed with Wine
107 SYSREG=yes                    # whether to make root's registry global (system-default)
108 CONVCONF=no                   # whether we are converting an existing .winerc or not
109
110 # "make install" still installs the dlls into $libdir, but this may change in the future
111 # (DLLPATH should point to them if/when they are not in standard ld.so paths)
112 DLLPATH=$libdir/wine          # default path of the dll .so files (except libwine.so)
113
114 # having the Wine debugger launched automatically will be a plus for us
115 DEBUGGER=$bindir/winedbg      # the (installed) path of winedbg
116 HDEBUGGER=debugger/winedbg    # the (non-installed) path of winedbg
117
118 # this is only for existing-windows installs
119 WINECONF=tools/wineconf       # path to the wineconf perl script
120
121 # this is only for no-windows installs
122 WINEINI=$exdir/config         # path to the default wine config file (also used by wineconf)
123 WININI=/dev/null              # path to the default win.ini
124 SYSTEMINI=$exdir/system.ini   # path to the default system.ini
125 REGEDIT=$bindir/regedit       # path to the regedit winelib application
126 DEFREG=winedefault.reg        # path of the registry file to be fed to regedit
127 # CROOT=/var/wine             # path of the fake Drive C (asks user if not set)
128 DEFCAT=cat                    # program to cat $DEFREG with (some packages need zcat)
129 #--- end of defaults
130
131 # temporary files used by the installer
132 TMPCONF=/tmp/wineinstall.conf
133 TMPREG=/tmp/wineinstall.reg
134
135 # functions
136
137 function std_sleep {
138   sleep 1
139 }
140
141 function conf_question {
142   # parameters: $1 = importance, $2 = question-id, $3+ = message lines
143   # the first two parameters can be used by e.g. debconf in debian packages
144   # but here we just print the message
145   shift 2
146   echo
147   local LINE="$1"
148   while shift
149   do {
150     echo "$LINE"
151     LINE="$1"
152   }
153   done
154 }
155
156 function conf_reset_question {
157   # parameters: $1 = question-id
158   # this is used to flush any cached answers and "already-displayed" flags
159   shift # dummy command
160 }
161
162 function conf_yesno_answer {
163   unset ANSWER
164   while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
165   do {
166     echo -n "$1"
167     read ANSWER
168   }
169   done
170 }
171
172 function conf_string_answer {
173   echo -n "$1"
174   read ANSWER
175 }
176
177 function create_windows_directories {
178   for tdir in "$CROOT/windows" "$CROOT/windows/system" "$CROOT/windows/system32" \
179               "$CROOT/windows/Start Menu" "$CROOT/windows/Start Menu/Programs" \
180               "$CROOT/Program Files" "$CROOT/Program Files/Common Files" \
181               "$CROOT/windows/Profiles" "$CROOT/windows/Profiles/Administrator" \
182               "$CROOT/windows/Fonts" "$CROOT/windows/Start Menu/Programs/Startup"
183   do [ -d "$tdir" ] || mkdir "$tdir"
184   done
185   [ -f "$CROOT/windows/win.ini" ]    || cp "$WININI"    "$CROOT/windows/win.ini"
186   [ -f "$CROOT/windows/system.ini" ] || cp "$SYSTEMINI" "$CROOT/windows/system.ini"
187 }
188
189 #creates symbolic link in windows directory to installed winelib application
190 #parameters:
191 # - name of the installed winelib application
192 # - full path to application in the winelib directory
193 function link_app {
194   ln -sf $libdir/wine/$1.exe.so $2
195 }
196
197 #puts windows applications replacements to windows directories,
198 #configures them
199 function configure_wine_applications {
200   link_app notepad      "$CROOT/windows/notepad.exe"
201   link_app regedit      "$CROOT/windows/regedit.exe"
202   link_app wcmd         "$CROOT/windows/system32/cmd.exe"
203   link_app control      "$CROOT/windows/system32/control.exe"
204   link_app winhelp      "$CROOT/windows/system32/help.exe"
205   link_app notepad      "$CROOT/windows/system32/notepad.exe"
206   link_app progman      "$CROOT/windows/system32/progman.exe"
207   link_app regsvr32     "$CROOT/windows/system32/regsvr32.exe"
208   link_app winemine     "$CROOT/windows/system32/winmine.exe"
209   link_app winver       "$CROOT/windows/system32/winver.exe"
210   link_app uninstaller  "$CROOT/windows/uninstall.exe"
211   link_app winhelp      "$CROOT/windows/winhelp.exe"
212   link_app winhelp      "$CROOT/windows/winhlp32.exe"
213 }
214
215 # startup...
216
217 echo "WINE Installer v0.73"
218 echo
219
220 if [ "$BINDIST" = 'no' ]
221 then {
222
223   if ! [ -f configure ]
224   then {
225     echo "You're running this from the wrong directory."
226     echo "Change to the Wine source's main directory and try again."
227     exit 1
228   }
229   fi
230
231   if [ `whoami` == 'root' ]
232   then {
233     echo "You are running wineinstall as root, this is not advisable. Please rerun as a user."
234     echo "Aborting."
235     exit 1
236   }
237   fi
238
239   # check whether RPM installed, and if it is, remove any old wine rpm.
240   hash rpm &>/dev/null
241   RET=$?
242   if [ $RET -eq 0 ]; then
243     if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name"`" ]; then
244       echo "Warning: Old Wine RPM install detected. Do you want to remove it first?"
245       conf_yesno_answer "(yes/no) "
246       if [ "$ANSWER" = 'yes' ]; then
247         echo "We need to remove the rpm as root, please enter your root password"
248         echo
249         echo Starting wine rpm removal...
250         su -c "rpm -e wine; RET=$?"
251         if [ $RET -eq 0 ]; then
252           echo Done.
253         else
254           echo "FAILED. Probably you aren't installing as root."
255           echo "Expect problems (library conflicts with existing install etc.)."
256         fi
257       else
258         echo "Sorry, I won't install Wine when an rpm version is still installed."
259         echo "(Wine support suffered from way too many conflicts between RPM"
260         echo "and source installs)"
261         echo "Have a nice day !"
262         exit 1
263       fi
264     fi
265   fi
266
267   # check whether wine binary still available
268   if [ -n "`which wine 2>/dev/null|grep '/wine'`" ]; then
269     echo "Warning !! wine binary (still) found, which may indicate"
270     echo "a (conflicting) previous installation."
271     echo "You might want to abort and uninstall Wine first."
272     std_sleep
273   fi
274
275   # run the configure script, if necessary
276
277   if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
278   then {
279     echo
280     echo "I see that WINE has already been configured, so I'll skip that."
281     std_sleep
282     # load configure results
283     . ./config.cache
284   }
285   else {
286     echo "Running configure..."
287     echo
288     if ! ./configure -C $CONFARGS
289     then {
290       echo
291       echo "Configure failed, aborting install."
292       rm -f config.cache
293       exit 1
294     }
295     fi
296     # load configure results
297     . ./config.cache
298     # make sure X was found
299     eval "$ac_cv_have_x"
300     if [ "$have_x" != "yes" ]
301     then {
302       echo "Install the X development headers and try again."
303       rm -f config.cache
304       exit 1
305     }
306     fi
307   }
308   fi
309
310   # now do the compilation and install, we need to always do this because we
311   # don't want the 'make install' command we might run to run 'make' as root
312   if [ `whoami` != 'root' ]
313   then {
314     # ask the user if they want to build and install wine
315     echo
316     echo "We need to install wine as root user, do you want us to build wine,"
317     echo "'su root' and install Wine?  Enter 'no' to continue without installing"
318     conf_yesno_answer "(yes/no) "
319
320     if [ "$ANSWER" = "yes" ]
321     then {
322       # start out with the basic command
323       sucommand="make install"
324
325       # if the user doesn't have $libdir in their ld.so.conf add this
326       # to our sucommand string
327       if [ -f /etc/ld.so.conf ]
328       then
329         if ! grep -qs "$libdir" /etc/ld.so.conf
330         then {
331           echo
332           echo "$libdir doesn't exist in your /etc/ld.so.conf, it will be added"
333           echo "when we perform the install..."
334           sucommand="$sucommand;echo $libdir>>/etc/ld.so.conf"
335         }
336         fi
337         # run ldconfig always just in case some updated files dont get linked
338         sucommand="$sucommand;$ac_cv_path_LDCONFIG"
339       fi
340
341       echo
342
343       echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever,"
344       echo "in the meantime..."
345       echo
346       std_sleep
347
348       # try to just make wine, if this fails 'make depend' and try to remake
349       if ! { make; }
350       then {
351         if ! { make depend && make; }
352         then {
353           echo
354           echo "Compilation failed, aborting install."
355           exit 1
356         }
357         fi
358       }
359       fi
360       echo
361
362       echo "Performing 'make install' as root to install binaries, enter root password"
363
364       std_sleep
365
366       if ! su root -c "$sucommand"
367       then {
368         echo
369         echo "Either you entered an incorrect password or we failed to run"
370         echo "'$sucommand' correctly."
371         echo "If you didn't enter an incorrect password then please report this"
372         echo "error and any steps to possibly reproduce it to"
373         echo "http://bugs.winehq.com/"
374         echo
375         echo "Installation failed, aborting."
376         exit 1
377       }
378       fi
379
380       echo
381
382       # see if wine is installed on the users system, if not prompt them
383       # and then exit
384       if [ ! `which wine` ]
385       then
386         echo "Could not find wine on your system.  Run wineinstall as root to install wine"
387         echo "before re-running wineinstall as a user."
388         echo
389         echo "Exiting wineinstall"
390         exit 1;
391       fi
392     }
393     else {
394       # user didn't want to install wine so tell them about running from the
395       # current directory and set some stuff up for them
396
397       # setup to run from current directory
398       DLLPATH="$PWD/dlls"
399       if [ -z "$LD_LIBRARY_PATH" ]
400       then LD_LIBRARY_PATH="$PWD:$DLLPATH"
401       else LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD:$DLLPATH"
402       fi
403       export LD_LIBRARY_PATH
404       DEBUGGER="$PWD/$HDEBUGGER"
405       echo
406       echo "NOTE! To run Wine without installing, you must set the environment variable"
407       echo "LD_LIBRARY_PATH to $PWD:$DLLPATH"
408       echo "in your logon scripts."
409       echo
410     }
411     fi
412   }
413   fi # [ `whoami` != 'root' ]
414
415 }
416 fi # BINDIST
417
418 # now check whether we should generate wine.conf
419 if [ -z "$DOGLOBALCONF" ]
420 then
421   DOGLOBALCONF=auto
422 fi
423
424 if [ "$DOGLOBALCONF" = 'auto' ]
425 then {
426   # see if we already have a system wine.conf
427   if [ ! -f $GCONF ] && [ `whoami` = 'root' ]
428   then
429     DOGLOBALCONF=no
430     echo "Creation of a global config file is not supported in wineinstall at this"
431     echo "time.  When the configuration architecture is cleaned up this functionality"
432     echo "will be restored to wineinstall."
433     echo
434   fi
435 }
436 fi
437
438 if [ "$DOLOCALCONF" = 'auto' ]
439 then {
440   # see if the user is root, if so, explicitly ask them if they want a
441   # local config file
442   if [ `whoami` = 'root' ]
443   then
444     echo "You are running as root.  Do you want a local config file,"
445     echo "file, ~/.wine/config, created?"
446     conf_yesno_answer "(yes/no) "
447     DOLOCALCONF="$ANSWER"
448   else
449     # if the user has an existing config file ask them if they want us to
450     # overwrite it, otherwise just ask them if they want to create one
451     if [ -f "$LCONF" ]
452     then
453       echo "Found existing $LCONF, do you want to overwrite this"
454       echo "existing Wine configuration file?"
455       conf_yesno_answer "(yes/no) "
456       DOLOCALCONF="$ANSWER"
457       echo
458       if [ "$ANSWER" = "yes" ]
459       then
460       {
461         echo "Would you like to make a backup of this old config file?"
462         conf_yesno_answer "(yes/no) "
463         echo
464         if [ "$ANSWER" = "yes" ]
465         then
466         {
467           echo "Renaming $LCONF to $LCONF.old"
468           mv -f "$LCONF" "$LCONF.old"
469           echo
470         }
471         fi
472       }
473       fi
474     else
475     {
476       echo "Create local config file ~/.wine/config?"
477       conf_yesno_answer "(yes/no) "
478       DOLOCALCONF="$ANSWER"
479       echo
480       if [ "$ANSWER" = 'no' ]
481       then
482         conf_question high need_root \
483           "Aborting install. Try again as root to generate a system wine.conf."
484         exit 1
485       fi
486     }
487     fi
488   fi
489 }
490 fi
491
492 # generate $TMPCONF from existing windows install, if any
493 if [ "$DOLOCALCONF" = 'yes' ]
494 then {
495   if [ "$DOWCHK" = 'yes' ] || [ "$DOWCHK" = 'auto' ]
496   then {
497     echo -n "Searching for an existing Windows installation..."
498     if ! $WINECONF -inifile "$WINEINI" > $TMPCONF 2>/dev/null
499     then {
500       rm -f $TMPCONF $TMPREG > /dev/null
501
502       echo " not found. (no matching /etc/fstab mount entry found)"
503       conf_question low do_without_windows \
504        "Windows was not found on your system, so I assume you want" \
505        "a Wine-only installation. Am I correct?"
506       conf_yesno_answer "(yes/no) "
507       if [ "$ANSWER" = 'no' ]
508       then {
509         conf_question high windows_not_found \
510          "Aborting install. Make sure your Windows partition is mounted and try again," \
511          "or create $LCONF manually by copying from $WINEINI and adapting the drive paths."
512         exit 1
513       }
514       fi
515       DOWINE=yes
516     }
517     else {
518       echo " found."
519
520       conf_reset_question windows_found
521       conf_question low windows_found \
522        "Created $LCONF using your existing Windows installation." \
523        "You probably want to review the file, though."
524       DOWINE=no
525     }
526     fi
527   }
528   elif [ "$DOWINE" = 'auto' ]
529   then DOWINE=yes
530   fi
531 }
532 elif [ "$DOWINE" = 'auto' ]
533 then
534   DOWINE=no
535 fi
536
537 # setup a no-windows installation, if necessary
538 if [ "$DOWINE" = 'yes' ]
539 then {
540   # set an appropriate DCROOT
541   if [ `whoami` != 'root' ]
542   then DCROOT=~/c
543   else DCROOT=/c
544   fi
545
546   if [ -f ~/.winerc ]
547   then {
548     conf_question medium convert_config \
549      "I found the old version Wine config file, .winerc, in your " \
550      "home directory.  I can convert this to the new format or use the" \
551      "new default Wine config file. Convert?"
552     conf_yesno_answer "(yes/no) "
553     if [ "$ANSWER" = 'yes' ]
554     then {
555       WINEINI=~/.winerc
556       CONVCONF=yes
557     }
558     fi
559   }
560   else {
561
562     conf_question low drivec_path \
563      "Configuring Wine without Windows." \
564      "Some fake Windows directories must be created, to hold any .ini files, DLLs," \
565      "start menu entries, and other things your applications may need to install." \
566      "Where would you like your fake C drive to be placed?"
567     while [ -z "$CROOT" ]
568     do {
569       conf_string_answer "(default is $DCROOT) "
570       [ -z "$ANSWER" ] && ANSWER="$DCROOT"
571       if ! [ -d "$ANSWER" ]
572       then {
573         if mkdir -p "$ANSWER"
574         then CROOT="$ANSWER"
575         else
576           echo "Directory $ANSWER can't be created !"
577           conf_reset_question drivec_path
578         fi
579       }
580       else CROOT="$ANSWER"
581       fi
582     }
583     done
584     echo "Configuring Wine for a no-windows install in $CROOT..."
585
586     create_windows_directories
587     configure_wine_applications
588   }
589   fi
590
591   # create $LCONF using the default config file $WINEINI
592   if [ "$DOLOCALCONF" = 'yes' ] && [ "$CONVCONF" = 'no' ]
593   then {
594     sed "s|\"Path\" = \"/c\"\$|\"Path\" = \"${CROOT}\"|" $WINEINI > $TMPCONF
595     conf_reset_question default_config
596     conf_question low default_config \
597      "Created $LCONF using default Wine configuration." \
598      "You probably want to review the file, though."
599   }
600   fi
601
602   # now we really should install the registry
603   if [ "$DOREG" = 'auto' ]
604   then DOREG=yes
605   fi
606 }
607 fi
608 echo
609
610 #install the local config file $LCONF
611 if [ "$DOLOCALCONF" = 'yes' ]
612 then
613   if [ ! -w ~/.wine ]
614   then
615     mkdir ~/.wine
616   fi
617
618   if [ "$CONVCONF" = 'no' ]
619   then
620     cp $TMPCONF $LCONF > /dev/null
621   fi
622 else
623   DOREG=no
624 fi
625
626 #install the global config file $GCONF
627 if [ "$DOGLOBALCONF" = 'yes' ]
628 then
629   if [ ! -f $sysconfdir ]
630   then
631     mkdir -p $sysconfdir
632   fi
633
634   cp $TMPCONF $GCONF > /dev/null
635 fi
636
637 # check whether we need to install default registry
638 # (not to be done if windows registry exists)
639 if [ "$DOREG" = 'auto' ]
640 then {
641   CROOT=`sed -n '/^\[Drive C\]$/,/^\[.*\]$/ s/^\"Path\" = \"\(.*\)\"/\1/p' $LCONF`
642   echo "Checking for real Windows registry..."
643   if [ -f "$CROOT/windows/system.dat" ]
644   then DOREG=no
645   elif [ -f "$CROOT/windows/system32/config/system" ]
646   then DOREG=no
647   elif [ -f "$CROOT/WINNT/system32/config/system" ]
648   then DOREG=no
649   else DOREG=yes
650   fi
651   if [ "$DOREG" = 'yes' ]
652   then echo "Not found, default Wine registry will be installed."
653   else echo "Windows registry found, will not install default Wine registry."
654   fi
655   echo
656 }
657 fi
658
659 # install default registry entries
660 if [ "$DOREG" = 'yes' ]
661 then {
662   if [ "$BINDIST" = 'no' ]
663   then {
664     echo "Compiling regedit..."
665     (cd programs/regedit; make)
666     echo
667   }
668   fi
669   echo "Preparing to install default Wine registry entries..."
670
671   # edit config files so we don't have to run regedit under X
672   if [ "$CONVCONF" = 'yes' ]
673   then
674     mv $WINEINI $WINEINI.new
675     sed "s/GraphicsDriver=.*/GraphicsDriver=ttydrv/" $WINEINI.new > $WINEINI
676   else
677     mv $LCONF $LCONF.new
678     sed "s/\"GraphicsDriver\" = .*/\"GraphicsDriver\" = \"ttydrv\"/" $LCONF.new > $LCONF
679   fi
680
681   # create a temporary wineinstall.reg with fixed debugger path
682   $DEFCAT $DEFREG | sed "s|debugger/winedbg|${DEBUGGER}|" > $TMPREG
683
684   echo "Installing default Wine registry entries..."
685   echo
686   if ! $REGEDIT $TMPREG > /dev/null
687   then {
688     rm -f $TMPREG
689     echo "Registry install failed."
690     conf_reset_question regedit_error
691     conf_question high regedit_error
692     exit 1
693   }
694   else {
695     # if we are converting from a .winerc file, running regedit once
696     # will ONLY convert .winerc -> ~/.wine/config, it will not import the
697     # registry data.  so if we are converting we need to run regedit twice
698     if [ "$CONVCONF" = 'yes' ]
699     then
700       if ! $REGEDIT $TMPREG > /dev/null
701       then
702         rm -f $TMPREG
703         echo "Registry install failed."
704         conf_reset_question regedit_error
705         conf_question high regedit_error
706         exit 1
707       else
708         echo
709         echo "Registry entries successfully installed."
710       fi
711     else
712       echo
713       echo "Registry entries successfully installed."
714     fi
715   }
716   fi
717   rm -f $TMPREG
718   if [ "$SYSREG" = 'auto' ]
719   then SYSREG=yes
720   fi
721
722   # if we converted we need to change the graphics driver back and
723   # restore the original .winerc file
724   if [ "$CONVCONF" = 'yes' ]
725   then
726      mv $WINEINI.new $WINEINI
727   fi
728
729   sed "s/\"GraphicsDriver\" = .*/\"GraphicsDriver\" = \"x11drv\"/" $LCONF > $LCONF.new
730   mv $LCONF.new $LCONF
731 }
732 fi
733
734 # make root's registry global, if desired
735 if [ `whoami` = 'root' ] && [ "$DOREG" = 'yes' ] && [ "$SYSREG" = 'yes' ]
736 then {
737   [ -d ~/.wine ] || mkdir ~/.wine
738   if ! [ -f $sysconfdir/wine.userreg ]
739   then {
740     echo "Linking root's user registry hive to the global registry..."
741     [ -f ~/.wine/wine.userreg ] && cp ~/.wine/wine.userreg $sysconfdir/wine.userreg
742     ln -sf $sysconfdir/wine.userreg ~/.wine/wine.userreg
743   }
744   fi
745   if ! [ -f $sysconfdir/wine.systemreg ]
746   then {
747     echo "Linking root's system registry hive to the global registry..."
748     [ -f ~/.wine/system.reg ] && cp ~/.wine/system.reg $sysconfdir/wine.systemreg
749     ln -sf $sysconfdir/wine.systemreg ~/.wine/system.reg
750   }
751   fi
752 }
753 fi
754
755 # cleanup any temporary files that may remain
756 if [ -f $TMPCONF ]
757 then rm -f $TMPCONF
758 fi
759 if [ -f $TMPREG ]
760 then rm -f $TMPREG
761 fi
762
763
764 # it's a wrap
765 echo
766 echo "Installation complete for now. Good luck (this is still alpha software)."
767 echo "If you have problems with WINE, please read the documentation first,"
768 echo "as many kinds of potential problems are explained there."
769
770 exit 0