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 #--- defaults (change these if you are a packager)
23 CONFARGS
="" # configure args, e.g. --prefix=/usr --sysconfdir=/etc
24 prefix
=/usr
/local # installation prefix
25 sysconfdir
=$prefix/etc
# where wine.conf and the global registry are supposed to be
26 bindir
=$prefix/bin
# where winelib apps will be (or are) installed
27 libdir
=$prefix/lib
# where libwine.so will be (or is) installed
28 exdir
=documentation
/samples
# where the sample system.ini resides
29 LCONF
=~
/.wine
/config
# default path of the local config file
30 BINDIST
=no
# whether called from a binary package config script
31 DOLOCALCONF
=auto
# whether to autogenerate localconf
32 DOWCHK
=auto
# whether to autoconfigure existing-windows installation
33 DOWINE
=auto
# whether to autoconfigure no-windows installation
34 DOREG
=auto
# whether to install default registry
35 DOAPP
=auto
# whether to install applications, distributed with Wine
36 SYSREG
=yes # whether to make root's registry global (system-default)
38 # this is only for existing-windows installs
39 WINECONF
=tools
/wineconf
# path to the wineconf perl script
41 # this is only for no-windows installs
42 WINEINI
=$exdir/config
# path to the default wine config file (also used by wineconf)
43 # CROOT=/var/wine # path of the fake Drive C (asks user if not set)
46 # temporary files used by the installer
47 TMPCONF
=/tmp
/wineinstall.conf
55 function conf_question
{
56 # parameters: $1 = importance, $2 = question-id, $3+ = message lines
57 # the first two parameters can be used by e.g. debconf in debian packages
58 # but here we just print the message
70 function conf_reset_question
{
71 # parameters: $1 = question-id
72 # this is used to flush any cached answers and "already-displayed" flags
76 function conf_yesno_answer
{
78 while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
86 function conf_string_answer
{
93 echo "WINE Installer v0.74"
96 if [ "$BINDIST" = 'no' ]
101 if [ -f ..
/configure
]
106 echo "You're running this from the wrong directory."
107 echo "Change to the Wine source's main directory and try again."
114 if [ `whoami` = 'root' ]
116 echo "You are running wineinstall as root, this is not advisable. Please rerun as a user."
124 echo "The source directory is not writable. You probably extracted the sources as root."
125 echo "You should remove the source tree and extract it again as a normal user."
130 # check whether RPM installed, and if it is, remove any old wine rpm.
133 if [ $RET -eq 0 ]; then
134 if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name
"`" ]; then
135 echo "Warning: Old Wine RPM install detected. Do you want to remove it first?"
136 conf_yesno_answer
"(yes/no) "
137 if [ "$ANSWER" = 'yes' ]; then
138 echo "We need to remove the rpm as root, please enter your root password"
140 echo Starting wine rpm removal...
141 su
-c "rpm -e wine; RET=$?"
142 if [ $RET -eq 0 ]; then
145 echo "FAILED. Probably you aren't installing as root."
146 echo "Expect problems (library conflicts with existing install etc.)."
149 echo "Sorry, I won't install Wine when an rpm version is still installed."
150 echo "(Wine support suffered from way too many conflicts between RPM"
151 echo "and source installs)"
152 echo "Have a nice day !"
158 # check whether wine binary still available
159 if [ -n "`which wine 2>/dev/null|grep '/wine'`" ]; then
160 echo "Warning !! wine binary (still) found, which may indicate"
161 echo "a (conflicting) previous installation."
162 echo "You might want to abort and uninstall Wine first."
166 # run the configure script, if necessary
168 if [ -f config.cache
] && [ -f Makefile
] && [ Makefile
-nt configure
]
171 echo "I see that WINE has already been configured, so I'll skip that."
173 # load configure results
177 echo "Running configure..."
179 if ! .
/configure
-C $CONFARGS --prefix=$prefix
182 echo "Configure failed, aborting install."
187 # load configure results
189 # make sure X was found
191 if [ "$have_x" != "yes" ]
193 echo "Install the X development headers and try again."
201 # now do the compilation and install, we need to always do this because we
202 # don't want the 'make install' command we might run to run 'make' as root
203 if [ `whoami` != 'root' ]
205 # ask the user if they want to build and install wine
207 echo "We need to install wine as root user, do you want us to build wine,"
208 echo "'su root' and install Wine? Enter 'no' to continue without installing"
209 conf_yesno_answer
"(yes/no) "
210 ROOTINSTALL
="$ANSWER"
212 if [ "$ROOTINSTALL" = "yes" ]
214 # start out with the basic command
215 sucommand
="make install"
217 # if the user doesn't have $libdir in their ld.so.conf add this
218 # to our sucommand string
219 if [ -f /etc
/ld.so.conf
]
221 if ! grep -s "$libdir" /etc
/ld.so.conf
>/dev
/null
2>&1
224 echo "$libdir doesn't exist in your /etc/ld.so.conf, it will be added"
225 echo "when we perform the install..."
226 sucommand
="$sucommand;echo $libdir>>/etc/ld.so.conf"
229 # run ldconfig always just in case some updated files don't get linked
230 sucommand
="$sucommand;$ac_cv_path_LDCONFIG"
233 fi # [ "$ROOTINSTALL" = "yes" ]
237 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever,"
238 echo "in the meantime..."
242 # try to just make wine, if this fails 'make depend' and try to remake
245 if ! { make depend
&& make; }
248 echo "Compilation failed, aborting install."
255 if [ "$ROOTINSTALL" = "yes" ]
259 echo "Performing 'make install' as root to install binaries, enter root password"
263 if ! su root
-c "$sucommand"
265 if ! su root
-c "$sucommand"
268 echo "Either you entered an incorrect password or we failed to"
269 echo "run '$sucommand' correctly."
270 echo "If you didn't enter an incorrect password then please"
271 echo "report this error and any steps to possibly reproduce it to"
272 echo "http://bugs.winehq.org/"
274 echo "Installation failed, aborting."
283 # see if wine is installed on the users system, if not prompt them
285 if [ ! `which wine` ]
287 echo "Could not find wine on your system. Run wineinstall as root to install wine"
288 echo "before re-running wineinstall as a user."
290 echo "Exiting wineinstall"
299 fi # [ "$ROOTINSTALL" = "yes" ]
301 fi # [ `whoami` != 'root' ]
306 # now check whether we should generate wine.conf
307 if [ "$DOLOCALCONF" = 'auto' ]
309 # see if the user is root, if so, explicitly ask them if they want a
311 if [ `whoami` = 'root' ]
313 echo "You are running as root. Do you want a local config file,"
314 echo "file, ~/.wine/config, created?"
315 conf_yesno_answer
"(yes/no) "
316 DOLOCALCONF
="$ANSWER"
318 # if the user has an existing config file ask them if they want us to
319 # overwrite it, otherwise just ask them if they want to create one
322 echo "Found existing $LCONF, do you want to overwrite this"
323 echo "existing Wine configuration file?"
324 conf_yesno_answer
"(yes/no) "
325 DOLOCALCONF
="$ANSWER"
327 if [ "$ANSWER" = "yes" ]
330 echo "Would you like to make a backup of this old config file?"
331 conf_yesno_answer
"(yes/no) "
333 if [ "$ANSWER" = "yes" ]
336 echo "Renaming $LCONF to $LCONF.old"
337 mv -f "$LCONF" "$LCONF.old"
345 echo "Create local config file ~/.wine/config?"
346 conf_yesno_answer
"(yes/no) "
347 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."
361 # generate $TMPCONF from existing windows install, if any
362 if [ "$DOLOCALCONF" = 'yes' ]
364 if [ "$DOWCHK" = 'yes' ] ||
[ "$DOWCHK" = 'auto' ]
366 echo -n "Searching for an existing Windows installation..."
367 if ! $WINECONF -inifile "$WINEINI" > $TMPCONF 2>/dev
/null
369 rm -f $TMPCONF > /dev
/null
371 echo " not found. (no matching /etc/fstab mount entry found)"
372 conf_question low do_without_windows \
373 "Windows was not found on your system, so I assume you want" \
374 "a Wine-only installation. Am I correct?"
375 conf_yesno_answer
"(yes/no) "
376 if [ "$ANSWER" = 'no' ]
378 conf_question high windows_not_found \
379 "Aborting install. Make sure your Windows partition is mounted and try again," \
380 "or create $LCONF manually by copying from $WINEINI and adapting the drive paths."
389 conf_question low do_without_windows \
390 "Windows was found on your system, and so we can use the Windows" \
391 "Drive as our Wine drive. You may, however, wish to create a clean" \
392 "Wine install anyways."
393 conf_yesno_answer
"Should I use the Windows drive for the Wine install? (yes/no) "
394 if [ "$ANSWER" = 'yes' ]
396 conf_reset_question windows_found
397 conf_question low windows_found \
398 "Created $LCONF using your existing Windows installation." \
399 "You probably want to review the file, though."
409 elif [ "$DOWINE" = 'auto' ]
413 elif [ "$DOWINE" = 'auto' ]
418 # setup a no-windows installation, if necessary
419 if [ "$DOWINE" = 'yes' ]
421 # set an appropriate DCROOT
422 if [ `whoami` != 'root' ]
423 then DCROOT
=~
/.wine
/drive_c
427 conf_question low drivec_path \
428 "Configuring Wine without Windows." \
429 "Some fake Windows directories must be created, to hold any .ini files, DLLs," \
430 "start menu entries, and other things your applications may need to install." \
431 "Where would you like your fake C drive to be placed?"
432 while [ -z "$CROOT" ]
434 conf_string_answer
"(default is $DCROOT) "
435 [ -z "$ANSWER" ] && ANSWER
="$DCROOT"
436 if ! [ -d "$ANSWER" ]
438 if mkdir
-p "$ANSWER"
441 echo "Directory $ANSWER can't be created !"
442 conf_reset_question drivec_path
449 echo "Configuring Wine for a no-windows install in $CROOT..."
451 if [ ! -d ~
/.wine
/dosdevices
]
453 mkdir ~
/.wine
/dosdevices
454 ln -s /mnt
/fd0 ~
/.wine
/dosdevices
/a
:
455 ln -s $CROOT ~
/.wine
/dosdevices
/c
:
456 ln -s /cdrom ~
/.wine
/dosdevices
/d
:
457 ln -s /tmp ~
/.wine
/dosdevices
/e
:
458 ln -s ~ ~
/.wine
/dosdevices
/f
:
459 ln -s / ~
/.wine
/dosdevices
/z
:
462 if [ "$WINEINSTALLED" = 'no' ]
464 tools
/wineprefixcreate
--update --use-wine-tree .
466 wineprefixcreate
--update
469 # create $LCONF using the default config file $WINEINI
470 if [ "$DOLOCALCONF" = 'yes' ]
473 conf_reset_question default_config
474 conf_question low default_config \
475 "Created $LCONF using default Wine configuration." \
476 "You probably want to review the file, though."
480 # now we really should install the registry
481 if [ "$DOREG" = 'auto' ]
488 #install the local config file $LCONF
489 if [ "$DOLOCALCONF" = 'yes' ]
495 cp $TMPCONF $LCONF > /dev
/null
500 # make root's registry global, if desired
501 if [ `whoami` = 'root' ] && [ "$DOREG" = 'yes' ] && [ "$SYSREG" = 'yes' ]
503 [ -d ~
/.wine
] || mkdir ~
/.wine
504 if ! [ -f $sysconfdir/wine.userreg
]
506 echo "Linking root's user registry hive to the global registry..."
507 [ -f ~
/.wine
/wine.userreg
] && cp ~
/.wine
/wine.userreg
$sysconfdir/wine.userreg
508 ln -sf $sysconfdir/wine.userreg ~
/.wine
/wine.userreg
511 if ! [ -f $sysconfdir/wine.systemreg
]
513 echo "Linking root's system registry hive to the global registry..."
514 [ -f ~
/.wine
/system.reg
] && cp ~
/.wine
/system.reg
$sysconfdir/wine.systemreg
515 ln -sf $sysconfdir/wine.systemreg ~
/.wine
/system.reg
521 # cleanup any temporary files that may remain
529 echo "Installation complete for now. Good luck (this is still alpha software)."
530 echo "If you have problems with WINE, please read the documentation first,"
531 echo "as many kinds of potential problems are explained there."