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
62 while [ $# -gt 0 ] && shift
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."
163 echo "(If you previously tried to install from source manually, "
164 echo "run 'make uninstall' from the wine root directory)"
168 # run the configure script, if necessary
170 if [ -f config.cache
] && [ -f Makefile
] && [ Makefile
-nt configure
]
173 echo "I see that WINE has already been configured, so I'll skip that."
175 # load configure results
179 echo "Running configure..."
181 if ! .
/configure
-C $CONFARGS --prefix=$prefix
184 echo "Configure failed, aborting install."
189 # load configure results
191 # make sure X was found
193 if [ "$have_x" != "yes" ]
195 echo "Install the X development headers and try again."
203 # now do the compilation and install, we need to always do this because we
204 # don't want the 'make install' command we might run to run 'make' as root
205 if [ `whoami` != 'root' ]
207 # ask the user if they want to build and install wine
209 echo "We need to install wine as root user, do you want us to build wine,"
210 echo "'su root' and install Wine? Enter 'no' to continue without installing"
211 conf_yesno_answer
"(yes/no) "
212 ROOTINSTALL
="$ANSWER"
214 if [ "$ROOTINSTALL" = "yes" ]
216 # start out with the basic command
217 sucommand
="make install"
219 # if the user doesn't have $libdir in their ld.so.conf add this
220 # to our sucommand string
221 if [ -f /etc
/ld.so.conf
]
223 if ! grep -s "$libdir" /etc
/ld.so.conf
>/dev
/null
2>&1
226 echo "$libdir doesn't exist in your /etc/ld.so.conf, it will be added"
227 echo "when we perform the install..."
228 sucommand
="$sucommand;echo $libdir>>/etc/ld.so.conf"
231 # run ldconfig always just in case some updated files don't get linked
232 sucommand
="$sucommand;$ac_cv_path_LDCONFIG"
235 fi # [ "$ROOTINSTALL" = "yes" ]
239 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever,"
240 echo "in the meantime..."
244 # try to just make wine, if this fails 'make depend' and try to remake
247 if ! { make depend
&& make; }
250 echo "Compilation failed, aborting install."
257 if [ "$ROOTINSTALL" = "yes" ]
261 echo "Performing 'make install' as root to install binaries, enter root password"
265 if ! su root
-c "$sucommand"
267 if ! su root
-c "$sucommand"
270 echo "Either you entered an incorrect password or we failed to"
271 echo "run '$sucommand' correctly."
272 echo "If you didn't enter an incorrect password then please"
273 echo "report this error and any steps to possibly reproduce it to"
274 echo "http://bugs.winehq.org/"
276 echo "Installation failed, aborting."
285 # see if wine is installed on the users system, if not prompt them
287 if [ ! `which wine` ]
289 echo "Could not find wine on your system. Run wineinstall as root to install wine"
290 echo "before re-running wineinstall as a user."
292 echo "Exiting wineinstall"
301 fi # [ "$ROOTINSTALL" = "yes" ]
303 fi # [ `whoami` != 'root' ]
308 # now check whether we should generate wine.conf
309 if [ "$DOLOCALCONF" = 'auto' ]
311 # see if the user is root, if so, explicitly ask them if they want a
313 if [ `whoami` = 'root' ]
315 echo "You are running as root. Do you want a local config file,"
316 echo "file, ~/.wine/config, created?"
317 conf_yesno_answer
"(yes/no) "
318 DOLOCALCONF
="$ANSWER"
320 # if the user has an existing config file ask them if they want us to
321 # overwrite it, otherwise just ask them if they want to create one
324 echo "Found existing $LCONF, do you want to overwrite this"
325 echo "existing Wine configuration file?"
326 conf_yesno_answer
"(yes/no) "
327 DOLOCALCONF
="$ANSWER"
329 if [ "$ANSWER" = "yes" ]
332 echo "Would you like to make a backup of this old config file?"
333 conf_yesno_answer
"(yes/no) "
335 if [ "$ANSWER" = "yes" ]
338 echo "Renaming $LCONF to $LCONF.old"
339 mv -f "$LCONF" "$LCONF.old"
347 echo "Create local config file ~/.wine/config?"
348 conf_yesno_answer
"(yes/no) "
349 DOLOCALCONF
="$ANSWER"
351 if [ "$ANSWER" = 'no' ]
353 conf_question high need_root \
354 "Aborting install. Try again as root to generate a system wine.conf."
363 # generate $TMPCONF from existing windows install, if any
364 if [ "$DOLOCALCONF" = 'yes' ]
366 if [ "$DOWCHK" = 'yes' ] ||
[ "$DOWCHK" = 'auto' ]
368 echo -n "Searching for an existing Windows installation..."
369 if ! $WINECONF -inifile "$WINEINI" > $TMPCONF 2>/dev
/null
371 rm -f $TMPCONF > /dev
/null
373 echo " not found. (no matching /etc/fstab mount entry found)"
374 conf_question low do_without_windows \
375 "Windows was not found on your system, so I assume you want" \
376 "a Wine-only installation. Am I correct?"
377 conf_yesno_answer
"(yes/no) "
378 if [ "$ANSWER" = 'no' ]
380 conf_question high windows_not_found \
381 "Aborting install. Make sure your Windows partition is mounted and try again," \
382 "or create $LCONF manually by copying from $WINEINI and adapting the drive paths."
391 conf_question low do_without_windows \
392 "Windows was found on your system, and so we can use the Windows" \
393 "Drive as our Wine drive. You may, however, wish to create a clean" \
394 "Wine install anyways."
395 conf_yesno_answer
"Should I use the Windows drive for the Wine install? (yes/no) "
396 if [ "$ANSWER" = 'yes' ]
398 conf_reset_question windows_found
399 conf_question low windows_found \
400 "Created $LCONF using your existing Windows installation." \
401 "You probably want to review the file, though."
411 elif [ "$DOWINE" = 'auto' ]
415 elif [ "$DOWINE" = 'auto' ]
420 # setup a no-windows installation, if necessary
421 if [ "$DOWINE" = 'yes' ]
423 # set an appropriate DCROOT
424 if [ `whoami` != 'root' ]
425 then DCROOT
=~
/.wine
/drive_c
429 conf_question low drivec_path \
430 "Configuring Wine without Windows." \
431 "Some fake Windows directories must be created, to hold any .ini files, DLLs," \
432 "start menu entries, and other things your applications may need to install." \
433 "Where would you like your fake C drive to be placed?"
434 while [ -z "$CROOT" ]
436 conf_string_answer
"(default is $DCROOT) "
437 [ -z "$ANSWER" ] && ANSWER
="$DCROOT"
438 if ! [ -d "$ANSWER" ]
440 if mkdir
-p "$ANSWER"
443 echo "Directory $ANSWER can't be created !"
444 conf_reset_question drivec_path
451 echo "Configuring Wine for a no-windows install in $CROOT..."
453 if [ ! -d ~
/.wine
/dosdevices
]
455 [ -d ~
/.wine
] || mkdir ~
/.wine
456 mkdir ~
/.wine
/dosdevices
457 ln -s /mnt
/fd0 ~
/.wine
/dosdevices
/a
:
458 ln -s $CROOT ~
/.wine
/dosdevices
/c
:
459 ln -s /cdrom ~
/.wine
/dosdevices
/d
:
460 ln -s /tmp ~
/.wine
/dosdevices
/e
:
461 ln -s ~ ~
/.wine
/dosdevices
/f
:
462 ln -s / ~
/.wine
/dosdevices
/z
:
465 if [ "$WINEINSTALLED" = 'no' ]
467 tools
/wineprefixcreate
--update --use-wine-tree .
469 wineprefixcreate
--update
472 # create $LCONF using the default config file $WINEINI
473 if [ "$DOLOCALCONF" = 'yes' ]
476 conf_reset_question default_config
477 conf_question low default_config \
478 "Created $LCONF using default Wine configuration." \
479 "You probably want to review the file, though."
483 # now we really should install the registry
484 if [ "$DOREG" = 'auto' ]
491 #install the local config file $LCONF
492 if [ "$DOLOCALCONF" = 'yes' ]
498 cp $TMPCONF $LCONF > /dev
/null
503 # make root's registry global, if desired
504 if [ `whoami` = 'root' ] && [ "$DOREG" = 'yes' ] && [ "$SYSREG" = 'yes' ]
506 [ -d ~
/.wine
] || mkdir ~
/.wine
507 if ! [ -f $sysconfdir/wine.userreg
]
509 echo "Linking root's user registry hive to the global registry..."
510 [ -f ~
/.wine
/wine.userreg
] && cp ~
/.wine
/wine.userreg
$sysconfdir/wine.userreg
511 ln -sf $sysconfdir/wine.userreg ~
/.wine
/wine.userreg
514 if ! [ -f $sysconfdir/wine.systemreg
]
516 echo "Linking root's system registry hive to the global registry..."
517 [ -f ~
/.wine
/system.reg
] && cp ~
/.wine
/system.reg
$sysconfdir/wine.systemreg
518 ln -sf $sysconfdir/wine.systemreg ~
/.wine
/system.reg
524 # cleanup any temporary files that may remain
532 echo "Installation complete for now. Good luck (this is still alpha software)."
533 echo "If you have problems with WINE, please read the documentation first,"
534 echo "as many kinds of potential problems are explained there."