2 # WINE Installation script
3 # Can do almost everything from compiling to configuring...
5 # Copyright 1999 Ove Kåven
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.
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.
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
22 # Mar 31 1999 - Ove Kåven
24 # Dec 9 1999 - Ove Kåven
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
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
57 # add conf_question to allow root to install a local config file and
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
72 #--- defaults (change these if you are a packager)
73 CONFARGS
="--enable-opengl" # configure args, e.g. --prefix=/usr --sysconfdir=/etc
74 prefix
=/usr
/local # installation prefix
75 sysconfdir
=$prefix/etc
# where wine.conf and global registry is supposed to be
76 bindir
=$prefix/bin
# where winelib apps will be (or is) installed
77 libdir
=$prefix/lib
# where libwine.so will be (or is) installed
78 exdir
=documentation
/samples
# where the example system.ini resides
79 GCONF
=$sysconfdir/wine.conf
# default path of the wine.conf global config file
80 LCONF
=~
/.wine
/config
# default path of the local config file
81 BINDIST
=no
# whether called from a binary package config script
82 DOGLOBALCONF
=auto
# whether to autogenerate wine.conf
83 DOLOCALCONF
=auto
# whether to autogenerate localconf
84 DOWCHK
=auto
# whether to autoconfigure existing-windows installation
85 DOWINE
=auto
# whether to autoconfigure no-windows installation
86 DOREG
=auto
# whether to install default registry
87 SYSREG
=yes # whether to make root's registry global (system-default)
88 CONVCONF
=no
# whether we are converting an existing .winerc or not
90 # "make install" still installs the dlls into $libdir, but this may change in the future
91 # (DLLPATH should point to them if/when they are not in standard ld.so paths)
92 DLLPATH
=$libdir/wine
# default path of the dll .so files (except libwine.so)
94 # having the Wine debugger launched automatically will be a plus for us
95 DEBUGGER
=$bindir/winedbg
# the (installed) path of winedbg
96 HDEBUGGER
=debugger
/winedbg
# the (non-installed) path of winedbg
98 # this is only for existing-windows installs
99 WINECONF
=tools
/wineconf
# the path of wineconf perl script
101 # this is only for no-windows installs
102 WINEINI
=$exdir/config
# the path of default wine config file (also used by wineconf)
103 WININI
=/dev
/null
# the path of default win.ini
104 SYSTEMINI
=$exdir/system.ini
# the path of default system.ini
105 REGAPI
=programs
/regapi
/regapi
# the path of regapi winelib application
106 DEFREG
=winedefault.reg
# the path of the registry file to be fed to regapi
107 # CROOT=/var/wine # the path of the fake Drive C (asks user if not set)
108 DEFCAT
=cat # program to cat $DEFREG with (some packages need zcat)
111 # temporary files used by the installer
112 TMPCONF
=/tmp
/wineinstall.conf
113 TMPREG
=/tmp
/wineinstall.reg
121 function conf_question
{
122 # parameters: $1 = importance, $2 = question-id, $3+ = message lines
123 # the first two parameters can be used by e.g. debconf in debian packages
124 # but here we just print the message
136 function conf_reset_question
{
137 # parameters: $1 = question-id
138 # this is used to flush any cached answers and "already-displayed" flags
139 shift # dummy command
142 function conf_yesno_answer
{
144 while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
152 function conf_string_answer
{
157 function create_windows_directories
{
158 for tdir
in "$CROOT/windows" "$CROOT/windows/system" \
159 "$CROOT/windows/Start Menu" "$CROOT/windows/Start Menu/Programs" \
160 "$CROOT/Common Files" "$CROOT/Program Files" \
161 "$CROOT/windows/Profiles" "$CROOT/windows/Profiles/Administrator"
162 do [ -d "$tdir" ] || mkdir
"$tdir"
164 [ -f "$CROOT/windows/win.ini" ] ||
cp "$WININI" "$CROOT/windows/win.ini"
165 [ -f "$CROOT/windows/system.ini" ] ||
cp "$SYSTEMINI" "$CROOT/windows/system.ini"
170 echo "WINE Installer v0.71"
173 if [ "$BINDIST" = 'no' ]
176 if ! [ -f configure
]
178 echo "You're running this from the wrong directory."
179 echo "Change to the Wine source's main directory and try again."
184 # check whether RPM installed, and if it is, remove any old wine rpm.
187 if [ $RET -eq 0 ]; then
188 if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name
"`" ]; then
189 echo "Warning: Old Wine RPM install detected. Do you want to remove it first?"
190 conf_yesno_answer
"(yes/no) "
191 if [ "$ANSWER" = 'yes' ]; then
192 echo Starting wine rpm removal...
194 if [ $RET -eq 0 ]; then
197 echo "FAILED. Probably you aren't installing as root."
198 echo "Expect problems (library conflicts with existing install etc.)."
201 echo "Sorry, I won't install Wine when an rpm version is still installed."
202 echo "(Wine support suffered from way too many conflicts)"
203 echo "Have a nice day !"
209 # check whether wine binary still available
210 if [ -n "`which wine`" ]; then
211 echo "Warning !! wine binary (still) found, which may indicate"
212 echo "a (conflicting) previous installation."
213 echo "You might want to abort and uninstall Wine first."
217 # run the configure script, if necessary
219 if [ -f config.cache
] && [ -f Makefile
] && [ Makefile
-nt configure
]
221 echo "I see that WINE has already been configured, so I'll skip that."
223 # load configure results
227 echo "Running configure..."
229 if ! .
/configure
-C $CONFARGS
232 echo "Configure failed, aborting install."
237 # load configure results
239 # make sure X was found
241 if [ "$have_x" != "yes" ]
243 echo "Install the X development headers and try again."
251 # now do the compilation
253 if [ -f wine
] && [ wine
-nt config.cache
]
255 echo "Hmm, looks like WINE is already compiled. I'll skip that too, I guess."
259 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever,"
260 echo "in the meantime..."
263 if ! { make depend
&& make; }
266 echo "Compilation failed, aborting install."
274 # and installation, if root
276 if [ `whoami` != 'root' ]
278 echo "You aren't root, so I'll skip the make install."
280 # setup to run from current directory
282 if [ -z "$LD_LIBRARY_PATH" ]
283 then LD_LIBRARY_PATH
="$PWD:$DLLPATH"
284 else LD_LIBRARY_PATH
="$LD_LIBRARY_PATH:$PWD:$DLLPATH"
286 export LD_LIBRARY_PATH
287 DEBUGGER
="$PWD/$HDEBUGGER"
289 echo "NOTE! To run Wine without installing, you must set the environment variable"
290 echo "LD_LIBRARY_PATH to $PWD:$DLLPATH"
291 echo "in your logon scripts."
294 # see if wine is installed on the users system, if not prompt them
296 if [ ! `which wine` ]
298 echo "Could not find wine on your system. Run wineinstall as root to install wine"
299 echo "before re-running wineinstall as a user."
301 echo "Exiting wineinstall"
306 echo "Now installing binaries onto the system..."
312 echo "Installation failed, aborting."
316 if [ -f /etc
/ld.so.conf
] && ! grep -qs "$libdir" /etc
/ld.so.conf
319 echo "$libdir didn't exist in your /etc/ld.so.conf, adding it now..."
320 echo "$libdir" >>/etc
/ld.so.conf
321 echo "Re-running ldconfig..."
322 eval "$ac_cv_path_LDCONFIG"
331 # now check whether we should generate wine.conf
332 if [ -z "$DOGLOBALCONF" ]
337 if [ "$DOGLOBALCONF" = 'auto' ]
339 # see if we already have a system wine.conf
340 if [ ! -f $GCONF ] && [ `whoami` = 'root' ]
343 echo "Creation of a global config file is not supported in wineinstall at this"
344 echo "time. When the configuration architecture is cleaned up this functionality"
345 echo "will be restored to wineinstall."
351 if [ "$DOLOCALCONF" = 'auto' ]
353 # see if the user is root, if so, explicitly ask them if they want a
355 if [ `whoami` = 'root' ]
357 echo "You are running as root. Do you want a local config file,"
358 echo "file, ~/.wine/config, created?"
359 conf_yesno_answer
"(yes/no) "
360 DOLOCALCONF
="$ANSWER"
362 echo "Create local config file ~/.wine/config?"
363 conf_yesno_answer
"(yes/no) "
365 DOLOCALCONF
="$ANSWER"
366 if [ "$ANSWER" = 'no' ]
368 conf_question high need_root \
369 "Aborting install. Try again as root to generate a system wine.conf."
376 echo "Found existing $LCONF, if you continue this file will be"
377 echo "overwritten. Continue running wineinstall?"
378 conf_yesno_answer
"(yes/no) "
380 if [ "$ANSWER" = 'no' ]
382 echo "Exiting wineinstall"
389 # generate $TMPCONF from existing windows install, if any
390 if [ "$DOLOCALCONF" = 'yes' ]
392 if [ "$DOWCHK" = 'yes' ] ||
[ "$DOWCHK" = 'auto' ]
394 echo -n "Searching for an existing Windows installation..."
395 if ! $WINECONF -inifile "$WINEINI" > $TMPCONF 2>/dev
/null
397 rm -f $TMPCONF $TMPREG > /dev
/null
399 echo " not found. (no matching /etc/fstab mount entry found)"
400 conf_question low do_without_windows \
401 "Windows was not found on your system, so I assume you want" \
402 "a Wine-only installation. Am I correct?"
403 conf_yesno_answer
"(yes/no) "
404 if [ "$ANSWER" = 'no' ]
406 conf_question high windows_not_found \
407 "Aborting install. Make sure your Windows partition is mounted and try again," \
408 "or create $LCONF manually by copying from $WINEINI and adapting the drive paths."
417 conf_reset_question windows_found
418 conf_question low windows_found \
419 "Created $LCONF using your existing Windows installation." \
420 "You probably want to review the file, though."
425 elif [ "$DOWINE" = 'auto' ]
429 elif [ "$DOWINE" = 'auto' ]
434 # setup a no-windows installation, if necessary
435 if [ "$DOWINE" = 'yes' ]
437 # set an appropriate DCROOT
438 if [ `whoami` != 'root' ]
445 conf_question medium convert_config \
446 "I found the old version Wine config file, .winerc, in your " \
447 "home directory. I can convert this to the new format or use the" \
448 "new default Wine config file. Convert?"
449 conf_yesno_answer
"(yes/no) "
450 if [ "$ANSWER" = 'yes' ]
459 conf_question low drivec_path \
460 "Configuring Wine without Windows." \
461 "Some fake Windows directories must be created, to hold any .ini files, DLLs," \
462 "start menu entries, and other things your applications may need to install." \
463 "Where would you like your fake C drive to be placed?"
464 while [ -z "$CROOT" ]
466 conf_string_answer
"(default is $DCROOT) "
467 [ -z "$ANSWER" ] && ANSWER
="$DCROOT"
468 if ! [ -d "$ANSWER" ]
470 if mkdir
-p "$ANSWER"
473 echo "Directory $ANSWER can't be created !"
474 conf_reset_question drivec_path
481 echo "Configuring Wine for a no-windows install in $CROOT..."
483 create_windows_directories
487 # create $LCONF using the default config file $WINEINI
488 if [ "$DOLOCALCONF" = 'yes' ] && [ "$CONVCONF" = 'no' ]
490 sed "s|\"Path\" = \"/c\"\$|\"Path\" = \"${CROOT}\"|" $WINEINI > $TMPCONF
491 conf_reset_question default_config
492 conf_question low default_config \
493 "Created $LCONF using default Wine configuration." \
494 "You probably want to review the file, though."
498 # now we really should install the registry
499 if [ "$DOREG" = 'auto' ]
506 #install the local config file $LCONF
507 if [ "$DOLOCALCONF" = 'yes' ]
514 if [ "$CONVCONF" = 'no' ]
516 cp $TMPCONF $LCONF > /dev
/null
522 #install the global config file $GCONF
523 if [ "$DOGLOBALCONF" = 'yes' ]
525 if [ ! -f $sysconfdir ]
530 cp $TMPCONF $GCONF > /dev
/null
533 # check whether we need to install default registry
534 # (not to be done if windows registry exists)
535 if [ "$DOREG" = 'auto' ]
537 echo "Checking for real Windows registry..."
538 if [ -f "$CROOT/windows/system.dat" ]
540 elif [ -f "$CROOT/windows/system32/config/system" ]
544 if [ "$DOREG" = 'yes' ]
545 then echo "Not found, default Wine registry will be installed."
546 else echo "Windows registry found, will not install default Wine registry."
552 # install default registry entries
553 if [ "$DOREG" = 'yes' ]
555 if [ "$BINDIST" = 'no' ]
557 echo "Compiling regapi..."
558 (cd programs
/regapi
; make)
562 echo "Preparing to install default Wine registry entries..."
564 # edit config files so we don't have to run regapi under X
565 if [ "$CONVCONF" = 'yes' ]
567 mv $WINEINI $WINEINI.new
568 sed "s/GraphicsDriver=.*/GraphicsDriver=ttydrv/" $WINEINI.new
> $WINEINI
571 sed "s/\"GraphicsDriver\" = .*/\"GraphicsDriver\" = \"ttydrv\"/" $LCONF.new
> $LCONF
574 # create a temporary wineinstall.reg with fixed debugger path
575 $DEFCAT $DEFREG |
sed "s|debugger/winedbg|${DEBUGGER}|" > $TMPREG
577 echo "Installing default Wine registry entries..."
579 if ! $REGAPI setValue
< $TMPREG > /dev
/null
582 echo "Registry install failed."
583 conf_reset_question regapi_error
584 conf_question high regapi_error
588 # if we are converting from a .winerc file, running regapi once
589 # will ONLY convert .winerc -> ~/.wine/config, it will not import the
590 # registry data. so if we are converting we need to run regapi twice
591 if [ "$CONVCONF" = 'yes' ]
593 if ! $REGAPI setValue
< $TMPREG > /dev
/null
596 echo "Registry install failed."
597 conf_reset_question regapi_error
598 conf_question high regapi_error
602 echo "Registry entries successfully installed."
606 echo "Registry entries successfully installed."
611 if [ "$SYSREG" = 'auto' ]
615 # if we converted we need to change the graphics driver back and
616 # restore the original .winerc file
617 if [ "$CONVCONF" = 'yes' ]
619 mv $WINEINI.new
$WINEINI
622 sed "s/\"GraphicsDriver\" = .*/\"GraphicsDriver\" = \"x11drv\"/" $LCONF > $LCONF.new
627 # make root's registry global, if desired
628 if [ `whoami` = 'root' ] && [ "$DOREG" = 'yes' ] && [ "$SYSREG" = 'yes' ]
630 [ -d ~
/.wine
] || mkdir ~
/.wine
631 if ! [ -f $sysconfdir/wine.userreg
]
633 echo "Linking root's user registry hive to the global registry..."
634 [ -f ~
/.wine
/wine.userreg
] && cp ~
/.wine
/wine.userreg
$sysconfdir/wine.userreg
635 ln -sf $sysconfdir/wine.userreg ~
/.wine
/wine.userreg
638 if ! [ -f $sysconfdir/wine.systemreg
]
640 echo "Linking root's system registry hive to the global registry..."
641 [ -f ~
/.wine
/system.reg
] && cp ~
/.wine
/system.reg
$sysconfdir/wine.systemreg
642 ln -sf $sysconfdir/wine.systemreg ~
/.wine
/system.reg
648 # cleanup any temporary files that may remain
659 echo "Installation complete for now. Good luck (this is still alpha software)."
660 echo "If you have problems with WINE, please read the documentation first,"
661 echo "as many kinds of potential problems are explained there."