2 # WINE Installation script
3 # Can do almost everything from compiling to configuring...
5 # Mar 31 1999 - Ove Kåven
7 # Dec 9 1999 - Ove Kåven
9 # Feb 25 2000 - Ove Kåven
10 # auto-add /usr/local/lib to /etc/ld.so.conf
11 # Mar 2 2000 - Ove Kåven
12 # source rather than grep config.cache
13 # use sourced config.cache to start ldconfig
14 # reconfigure if config.cache doesn't exist
15 # Mar 30 2000 - Ove Kåven
16 # autoconfigure no-windows installs
17 # do not install registry on real-windows installs
18 # some support for binary package installs
19 # set and tell user about LD_LIBRARY_PATH if necessary
20 # set EXTRA_LD_LIBRARY_PATH in wine.conf
21 # Apr 9 2000 - Ove Kåven
22 # make root's registry global (system-default)
23 # May 9 2000 - Ove Kåven
24 # use ttydrv when running regapi, so we don't have to run from X
25 # change debugger path in registry
26 # Oct 29 2000 - Ove Kåven
27 # added --enable-opengl to default confargs
28 # added conf_question, conf_yesno_answer, and conf_string_answer functions
29 # added DEFCAT variable
31 # added conf_reset_question function
32 # added file existence checks to the registry copying
33 # fixed problem with no-windows directory creation
34 # some text reformatting from Eric Maryniak
35 # Jan 5 2000 - Chris Morgan
36 # use default config file in /documentation/samples/config
37 # replace .winerc with ~/.wine/config in printed text
38 # added user question to convert .winerc file(if exists) or use the default
40 # add conf_question to allow root to install a local config file and
42 # Jan 12 2000 - Chris Morgan
43 # distinguish between creating local and global config files
44 # display a message about the status of global config files
45 # misc cleanups and reordering of questions
46 # added check to see if wine is installed when we are running as a normal
47 # user and print a message if wine cannot be found
48 # Feb 16 2002 - Adam D. Moss
49 # Use config.status instead of config.cache to check whether we're
50 # configured/compiled and to recreate the configuration
51 # Feb 20 2002 - Adam D. Moss
52 # Partially revert previous changes, force configure to write an
53 # old-style config.cache
55 #--- defaults (change these if you are a packager)
56 CONFARGS="--enable-opengl" # configure args, e.g. --prefix=/usr --sysconfdir=/etc
57 prefix=/usr/local # installation prefix
58 sysconfdir=$prefix/etc # where wine.conf and global registry is supposed to be
59 bindir=$prefix/bin # where winelib apps will be (or is) installed
60 libdir=$prefix/lib # where libwine.so will be (or is) installed
61 exdir=documentation/samples # where the example system.ini resides
62 GCONF=$sysconfdir/wine.conf # default path of the wine.conf global config file
63 LCONF=~/.wine/config # default path of the local config file
64 BINDIST=no # whether called from a binary package config script
65 DOGLOBALCONF=auto # whether to autogenerate wine.conf
66 DOLOCALCONF=auto # whether to autogenerate localconf
67 DOWCHK=auto # whether to autoconfigure existing-windows installation
68 DOWINE=auto # whether to autoconfigure no-windows installation
69 DOREG=auto # whether to install default registry
70 SYSREG=yes # whether to make root's registry global (system-default)
71 CONVCONF=no # whether we are converting an existing .winerc or not
73 # "make install" still installs the dlls into $libdir, but this may change in the future
74 # (DLLPATH should point to them if/when they are not in standard ld.so paths)
75 DLLPATH=$libdir/wine # default path of the dll .so files (except libwine.so)
77 # having the Wine debugger launched automatically will be a plus for us
78 DEBUGGER=$bindir/winedbg # the (installed) path of winedbg
79 HDEBUGGER=debugger/winedbg # the (non-installed) path of winedbg
81 # this is only for existing-windows installs
82 WINECONF=tools/wineconf # the path of wineconf perl script
84 # this is only for no-windows installs
85 WINEINI=$exdir/config # the path of default wine config file (also used by wineconf)
86 WININI=/dev/null # the path of default win.ini
87 SYSTEMINI=$exdir/system.ini # the path of default system.ini
88 REGAPI=programs/regapi/regapi # the path of regapi winelib application
89 DEFREG=winedefault.reg # the path of the registry file to be fed to regapi
90 # CROOT=/var/wine # the path of the fake Drive C (asks user if not set)
91 DEFCAT=cat # program to cat $DEFREG with (some packages need zcat)
94 # temporary files used by the installer
95 TMPCONF=/tmp/wineinstall.conf
96 TMPREG=/tmp/wineinstall.reg
104 function conf_question {
105 # parameters: $1 = importance, $2 = question-id, $3+ = message lines
106 # the first two parameters can be used by e.g. debconf in debian packages
107 # but here we just print the message
119 function conf_reset_question {
120 # parameters: $1 = question-id
121 # this is used to flush any cached answers and "already-displayed" flags
122 shift # dummy command
125 function conf_yesno_answer {
127 while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
135 function conf_string_answer {
140 function create_windows_directories {
141 for tdir in "$CROOT/windows" "$CROOT/windows/system" \
142 "$CROOT/windows/Start Menu" "$CROOT/windows/Start Menu/Programs" \
143 "$CROOT/Common Files" "$CROOT/Program Files" \
144 "$CROOT/windows/Profiles" "$CROOT/windows/Profiles/Administrator"
145 do [ -d "$tdir" ] || mkdir "$tdir"
147 [ -f "$CROOT/windows/win.ini" ] || cp "$WININI" "$CROOT/windows/win.ini"
148 [ -f "$CROOT/windows/system.ini" ] || cp "$SYSTEMINI" "$CROOT/windows/system.ini"
153 echo "WINE Installer v0.71"
156 if [ "$BINDIST" = 'no' ]
159 if ! [ -f configure ]
161 echo "You're running this from the wrong directory."
162 echo "Change to the Wine source's main directory and try again."
167 # check whether RPM installed, and if it is, remove any old wine rpm.
170 if [ $RET -eq 0 ]; then
171 if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name"`" ]; then
172 echo "Warning: Old Wine RPM install detected. Do you want to remove it first?"
173 conf_yesno_answer "(yes/no) "
174 if [ "$ANSWER" = 'yes' ]; then
175 echo Starting wine rpm removal...
177 if [ $RET -eq 0 ]; then
180 echo "FAILED. Probably you aren't installing as root."
181 echo "Expect problems (library conflicts with existing install etc.)."
184 echo "Sorry, I won't install Wine when an rpm version is still installed."
185 echo "(Wine support suffered from way too many conflicts)"
186 echo "Have a nice day !"
192 # check whether wine binary still available
193 if [ -n "`which wine`" ]; then
194 echo "Warning !! wine binary (still) found, which may indicate"
195 echo "a (conflicting) previous installation."
196 echo "You might want to abort and uninstall Wine first."
200 # run the configure script, if necessary
202 if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
204 echo "I see that WINE has already been configured, so I'll skip that."
206 # load configure results
210 echo "Running configure..."
212 if ! ./configure -C $CONFARGS
215 echo "Configure failed, aborting install."
220 # load configure results
222 # make sure X was found
224 if [ "$have_x" != "yes" ]
226 echo "Install the X development headers and try again."
234 # now do the compilation
236 if [ -f wine ] && [ wine -nt config.cache ]
238 echo "Hmm, looks like WINE is already compiled. I'll skip that too, I guess."
242 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever,"
243 echo "in the meantime..."
246 if ! { make depend && make; }
249 echo "Compilation failed, aborting install."
257 # and installation, if root
259 if [ `whoami` != 'root' ]
261 echo "You aren't root, so I'll skip the make install."
263 # setup to run from current directory
265 if [ -z "$LD_LIBRARY_PATH" ]
266 then LD_LIBRARY_PATH="$PWD:$DLLPATH"
267 else LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD:$DLLPATH"
269 export LD_LIBRARY_PATH
270 DEBUGGER="$PWD/$HDEBUGGER"
272 echo "NOTE! To run Wine without installing, you must set the environment variable"
273 echo "LD_LIBRARY_PATH to $PWD:$DLLPATH"
274 echo "in your logon scripts."
277 # see if wine is installed on the users system, if not prompt them
279 if [ ! `which wine` ]
281 echo "Could not find wine on your system. Run wineinstall as root to install wine"
282 echo "before re-running wineinstall as a user."
284 echo "Exiting wineinstall"
289 echo "Now installing binaries onto the system..."
295 echo "Installation failed, aborting."
299 if [ -f /etc/ld.so.conf ] && ! grep -qs "$libdir" /etc/ld.so.conf
302 echo "$libdir didn't exist in your /etc/ld.so.conf, adding it now..."
303 echo "$libdir" >>/etc/ld.so.conf
304 echo "Re-running ldconfig..."
305 eval "$ac_cv_path_LDCONFIG"
314 # now check whether we should generate wine.conf
315 if [ -z "$DOGLOBALCONF" ]
320 if [ "$DOGLOBALCONF" = 'auto' ]
322 # see if we already have a system wine.conf
323 if [ ! -f $GCONF ] && [ `whoami` = 'root' ]
326 echo "Creation of a global config file is not supported in wineinstall at this"
327 echo "time. When the configuration architecture is cleaned up this functionality"
328 echo "will be restored to wineinstall."
334 if [ "$DOLOCALCONF" = 'auto' ]
336 # see if the user is root, if so, explicitly ask them if they want a
338 if [ `whoami` = 'root' ]
340 echo "You are running as root. Do you want a local config file,"
341 echo "file, ~/.wine/config, created?"
342 conf_yesno_answer "(yes/no) "
343 DOLOCALCONF="$ANSWER"
345 echo "Create local config file ~/.wine/config?"
346 conf_yesno_answer "(yes/no) "
348 DOLOCALCONF="$ANSWER"
349 if [ "$ANSWER" = 'no' ]
351 conf_question high need_root \
352 "Aborting install. Try again as root to generate a system wine.conf."
359 echo "Found existing $LCONF, if you continue this file will be"
360 echo "overwritten. Continue running wineinstall?"
361 conf_yesno_answer "(yes/no) "
363 if [ "$ANSWER" = 'no' ]
365 echo "Exiting wineinstall"
372 # generate $TMPCONF from existing windows install, if any
373 if [ "$DOLOCALCONF" = 'yes' ]
375 if [ "$DOWCHK" = 'yes' ] || [ "$DOWCHK" = 'auto' ]
377 echo -n "Searching for an existing Windows installation..."
378 if ! $WINECONF -inifile "$WINEINI" > $TMPCONF 2>/dev/null
380 rm -f $TMPCONF $TMPREG > /dev/null
382 echo " not found. (no matching /etc/fstab mount entry found)"
383 conf_question low do_without_windows \
384 "Windows was not found on your system, so I assume you want" \
385 "a Wine-only installation. Am I correct?"
386 conf_yesno_answer "(yes/no) "
387 if [ "$ANSWER" = 'no' ]
389 conf_question high windows_not_found \
390 "Aborting install. Make sure your Windows partition is mounted and try again," \
391 "or create $LCONF manually by copying from $WINEINI and adapting the drive paths."
400 conf_reset_question windows_found
401 conf_question low windows_found \
402 "Created $LCONF using your existing Windows installation." \
403 "You probably want to review the file, though."
408 elif [ "$DOWINE" = 'auto' ]
412 elif [ "$DOWINE" = 'auto' ]
417 # setup a no-windows installation, if necessary
418 if [ "$DOWINE" = 'yes' ]
420 # set an appropriate DCROOT
421 if [ `whoami` != 'root' ]
428 conf_question medium convert_config \
429 "I found the old version Wine config file, .winerc, in your " \
430 "home directory. I can convert this to the new format or use the" \
431 "new default Wine config file. Convert?"
432 conf_yesno_answer "(yes/no) "
433 if [ "$ANSWER" = 'yes' ]
442 conf_question low drivec_path \
443 "Configuring Wine without Windows." \
444 "Some fake Windows directories must be created, to hold any .ini files, DLLs," \
445 "start menu entries, and other things your applications may need to install." \
446 "Where would you like your fake C drive to be placed?"
447 while [ -z "$CROOT" ]
449 conf_string_answer "(default is $DCROOT) "
450 [ -z "$ANSWER" ] && ANSWER="$DCROOT"
451 if ! [ -d "$ANSWER" ]
453 if mkdir -p "$ANSWER"
456 echo "Directory $ANSWER can't be created !"
457 conf_reset_question drivec_path
464 echo "Configuring Wine for a no-windows install in $CROOT..."
466 create_windows_directories
470 # create $LCONF using the default config file $WINEINI
471 if [ "$DOLOCALCONF" = 'yes' ] && [ "$CONVCONF" = 'no' ]
473 sed "s|\"Path\" = \"/c\"\$|\"Path\" = \"${CROOT}\"|" $WINEINI > $TMPCONF
474 conf_reset_question default_config
475 conf_question low default_config \
476 "Created $LCONF using default Wine configuration." \
477 "You probably want to review the file, though."
481 # now we really should install the registry
482 if [ "$DOREG" = 'auto' ]
489 #install the local config file $LCONF
490 if [ "$DOLOCALCONF" = 'yes' ]
497 if [ "$CONVCONF" = 'no' ]
499 cp $TMPCONF $LCONF > /dev/null
505 #install the global config file $GCONF
506 if [ "$DOGLOBALCONF" = 'yes' ]
508 if [ ! -f $sysconfdir ]
513 cp $TMPCONF $GCONF > /dev/null
516 # check whether we need to install default registry
517 # (not to be done if windows registry exists)
518 if [ "$DOREG" = 'auto' ]
520 echo "Checking for real Windows registry..."
521 if [ -f "$CROOT/windows/system.dat" ]
523 elif [ -f "$CROOT/windows/system32/config/system" ]
527 if [ "$DOREG" = 'yes' ]
528 then echo "Not found, default Wine registry will be installed."
529 else echo "Windows registry found, will not install default Wine registry."
535 # install default registry entries
536 if [ "$DOREG" = 'yes' ]
538 if [ "$BINDIST" = 'no' ]
540 echo "Compiling regapi..."
541 (cd programs/regapi; make)
545 echo "Preparing to install default Wine registry entries..."
547 # edit config files so we don't have to run regapi under X
548 if [ "$CONVCONF" = 'yes' ]
550 mv $WINEINI $WINEINI.new
551 sed "s/GraphicsDriver=.*/GraphicsDriver=ttydrv/" $WINEINI.new > $WINEINI
554 sed "s/\"GraphicsDriver\" = .*/\"GraphicsDriver\" = \"ttydrv\"/" $LCONF.new > $LCONF
557 # create a temporary wineinstall.reg with fixed debugger path
558 $DEFCAT $DEFREG | sed "s|debugger/winedbg|${DEBUGGER}|" > $TMPREG
560 echo "Installing default Wine registry entries..."
562 if ! $REGAPI setValue < $TMPREG > /dev/null
565 echo "Registry install failed."
566 conf_reset_question regapi_error
567 conf_question high regapi_error
571 # if we are converting from a .winerc file, running regapi once
572 # will ONLY convert .winerc -> ~/.wine/config, it will not import the
573 # registry data. so if we are converting we need to run regapi twice
574 if [ "$CONVCONF" = 'yes' ]
576 if ! $REGAPI setValue < $TMPREG > /dev/null
579 echo "Registry install failed."
580 conf_reset_question regapi_error
581 conf_question high regapi_error
585 echo "Registry entries successfully installed."
589 echo "Registry entries successfully installed."
594 if [ "$SYSREG" = 'auto' ]
598 # if we converted we need to change the graphics driver back and
599 # restore the original .winerc file
600 if [ "$CONVCONF" = 'yes' ]
602 mv $WINEINI.new $WINEINI
605 sed "s/\"GraphicsDriver\" = .*/\"GraphicsDriver\" = \"x11drv\"/" $LCONF > $LCONF.new
610 # make root's registry global, if desired
611 if [ `whoami` = 'root' ] && [ "$DOREG" = 'yes' ] && [ "$SYSREG" = 'yes' ]
613 [ -d ~/.wine ] || mkdir ~/.wine
614 if ! [ -f $sysconfdir/wine.userreg ]
616 echo "Linking root's user registry hive to the global registry..."
617 [ -f ~/.wine/wine.userreg ] && cp ~/.wine/wine.userreg $sysconfdir/wine.userreg
618 ln -sf $sysconfdir/wine.userreg ~/.wine/wine.userreg
621 if ! [ -f $sysconfdir/wine.systemreg ]
623 echo "Linking root's system registry hive to the global registry..."
624 [ -f ~/.wine/system.reg ] && cp ~/.wine/system.reg $sysconfdir/wine.systemreg
625 ln -sf $sysconfdir/wine.systemreg ~/.wine/system.reg
631 # cleanup any temporary files that may remain
642 echo "Installation complete for now. Good luck (this is still alpha software)."
643 echo "If you have problems with WINE, please read the documentation first,"
644 echo "as many kinds of potential problems are explained there."