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