blob: eb37264ce802f31f79fb87415b9ba405230cd7d6 [file] [log] [blame]
Ove Kaaven2043ba01999-04-18 13:16:29 +00001#!/bin/bash
2# WINE Installation script
Ove Kaaven2c767522000-10-29 18:02:53 +00003# Can do almost everything from compiling to configuring...
Ove Kaaven2043ba01999-04-18 13:16:29 +00004
5# Mar 31 1999 - Ove Kåven
6# First version
Ove Kaavenb822b842000-02-25 20:51:09 +00007# Dec 9 1999 - Ove Kåven
8# require Xpm
9# Feb 25 2000 - Ove Kåven
10# auto-add /usr/local/lib to /etc/ld.so.conf
Ove Kaavence2b7242000-03-04 19:13:52 +000011# 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
Ove Kaavene1858882000-04-08 20:20:21 +000015# 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
Ove Kaavenb5d37ec2000-04-15 20:37:14 +000021# Apr 9 2000 - Ove Kåven
22# make root's registry global (system-default)
Ove Kaavenf561aad2000-05-09 22:32:42 +000023# 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
Ove Kaaven2c767522000-10-29 18:02:53 +000026# 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
Ove Kaaven6e143b32000-10-31 00:59:01 +000030# (later that day...)
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
Chris Morgan3a213212001-01-11 20:18:06 +000035# 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
39# config file
Chris Morgan3a213212001-01-11 20:18:06 +000040# add conf_question to allow root to install a local config file and
41# registry
Chris Morgana00cefb2001-01-18 20:29:21 +000042# 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
Ove Kaaven2043ba01999-04-18 13:16:29 +000048
Ove Kaavenf561aad2000-05-09 22:32:42 +000049#--- defaults (change these if you are a packager)
Andreas Mohr8ee6cca2001-02-12 18:10:43 +000050CONFARGS="--enable-opengl" # configure args, e.g. --prefix=/usr --sysconfdir=/etc
Ove Kaavene1858882000-04-08 20:20:21 +000051prefix=/usr/local # installation prefix
Ove Kaavenb5d37ec2000-04-15 20:37:14 +000052sysconfdir=$prefix/etc # where wine.conf and global registry is supposed to be
Ove Kaavenf561aad2000-05-09 22:32:42 +000053bindir=$prefix/bin # where winelib apps will be (or is) installed
Ove Kaavenb5d37ec2000-04-15 20:37:14 +000054libdir=$prefix/lib # where libwine.so will be (or is) installed
55exdir=documentation/samples # where the example system.ini resides
Chris Morgana00cefb2001-01-18 20:29:21 +000056GCONF=$sysconfdir/wine.conf # default path of the wine.conf global config file
57LCONF=~/.wine/config # default path of the local config file
Ove Kaavene1858882000-04-08 20:20:21 +000058BINDIST=no # whether called from a binary package config script
Chris Morgana00cefb2001-01-18 20:29:21 +000059DOGLOBALCONF=auto # whether to autogenerate wine.conf
60DOLOCALCONF=auto # whether to autogenerate localconf
Ove Kaavene1858882000-04-08 20:20:21 +000061DOWCHK=auto # whether to autoconfigure existing-windows installation
62DOWINE=auto # whether to autoconfigure no-windows installation
63DOREG=auto # whether to install default registry
Ove Kaavenb5d37ec2000-04-15 20:37:14 +000064SYSREG=yes # whether to make root's registry global (system-default)
Chris Morgan3a213212001-01-11 20:18:06 +000065CONVCONF=no # whether we are converting an existing .winerc or not
Ove Kaavenf561aad2000-05-09 22:32:42 +000066
67# "make install" still installs the dlls into $libdir, but this may change in the future
68# (DLLPATH should point to them if/when they are not in standard ld.so paths)
69DLLPATH=$libdir/wine # default path of the dll .so files (except libwine.so)
70
71# having the Wine debugger launched automatically will be a plus for us
72DEBUGGER=$bindir/winedbg # the (installed) path of winedbg
73HDEBUGGER=debugger/winedbg # the (non-installed) path of winedbg
74
75# this is only for existing-windows installs
Ove Kaavenb5d37ec2000-04-15 20:37:14 +000076WINECONF=tools/wineconf # the path of wineconf perl script
Ove Kaavenf561aad2000-05-09 22:32:42 +000077
78# this is only for no-windows installs
Chris Morgan3a213212001-01-11 20:18:06 +000079WINEINI=$exdir/config # the path of default wine config file (also used by wineconf)
Ove Kaavene1858882000-04-08 20:20:21 +000080WININI=/dev/null # the path of default win.ini
Ove Kaavenb5d37ec2000-04-15 20:37:14 +000081SYSTEMINI=$exdir/system.ini # the path of default system.ini
Ove Kaavene1858882000-04-08 20:20:21 +000082REGAPI=programs/regapi/regapi # the path of regapi winelib application
83DEFREG=winedefault.reg # the path of the registry file to be fed to regapi
Ove Kaavenb5d37ec2000-04-15 20:37:14 +000084# CROOT=/var/wine # the path of the fake Drive C (asks user if not set)
Ove Kaaven2c767522000-10-29 18:02:53 +000085DEFCAT=cat # program to cat $DEFREG with (some packages need zcat)
Ove Kaavenf561aad2000-05-09 22:32:42 +000086#--- end of defaults
87
88# temporary files used by the installer
89TMPCONF=/tmp/wineinstall.conf
90TMPREG=/tmp/wineinstall.reg
Ove Kaaven2043ba01999-04-18 13:16:29 +000091
Ove Kaaven2c767522000-10-29 18:02:53 +000092# functions
93
Andreas Mohr6dc00542000-12-05 03:53:51 +000094function std_sleep {
95 sleep 1
96}
97
Ove Kaaven2c767522000-10-29 18:02:53 +000098function conf_question {
99 # parameters: $1 = importance, $2 = question-id, $3+ = message lines
100 # the first two parameters can be used by e.g. debconf in debian packages
101 # but here we just print the message
102 shift 2
103 echo
104 local LINE="$1"
105 while shift
106 do {
107 echo "$LINE"
108 LINE="$1"
109 }
110 done
111}
112
Ove Kaaven6e143b32000-10-31 00:59:01 +0000113function conf_reset_question {
114 # parameters: $1 = question-id
115 # this is used to flush any cached answers and "already-displayed" flags
116 shift # dummy command
117}
118
Ove Kaaven2c767522000-10-29 18:02:53 +0000119function conf_yesno_answer {
120 unset ANSWER
121 while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
122 do {
123 echo -n "$1"
124 read ANSWER
125 }
126 done
127}
128
129function conf_string_answer {
130 echo -n "$1"
131 read ANSWER
132}
133
Chris Morgana00cefb2001-01-18 20:29:21 +0000134function create_windows_directories {
135 for tdir in "$CROOT/windows" "$CROOT/windows/system" \
136 "$CROOT/windows/Start Menu" "$CROOT/windows/Start Menu/Programs" \
137 "$CROOT/Common Files" "$CROOT/Program Files" \
138 "$CROOT/windows/Profiles" "$CROOT/windows/Profiles/Administrator"
139 do [ -d "$tdir" ] || mkdir "$tdir"
140 done
141 [ -f "$CROOT/windows/win.ini" ] || cp "$WININI" "$CROOT/windows/win.ini"
142 [ -f "$CROOT/windows/system.ini" ] || cp "$SYSTEMINI" "$CROOT/windows/system.ini"
143}
144
Ove Kaaven2043ba01999-04-18 13:16:29 +0000145# startup...
146
Chris Morgana00cefb2001-01-18 20:29:21 +0000147echo "WINE Installer v0.7"
Ove Kaaven2043ba01999-04-18 13:16:29 +0000148echo
Ove Kaavene1858882000-04-08 20:20:21 +0000149
150if [ "$BINDIST" = 'no' ]
151then {
152
Ove Kaaven2043ba01999-04-18 13:16:29 +0000153if ! [ -f configure ]
154then {
155 echo "You're running this from the wrong directory."
Andreas Mohr8724ea82000-11-25 01:23:32 +0000156 echo "Change to the Wine source's main directory and try again."
Ove Kaaven2043ba01999-04-18 13:16:29 +0000157 exit 1
158}
159fi
160
Andreas Mohr8bba9ba2000-08-28 21:32:08 +0000161# check whether RPM installed, and if it is, remove any old wine rpm.
Ove Kaaven2c767522000-10-29 18:02:53 +0000162hash rpm &>/dev/null
163RET=$?
Andreas Mohr8bba9ba2000-08-28 21:32:08 +0000164if [ $RET -eq 0 ]; then
165 if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name"`" ]; then
Ove Kaaven2c767522000-10-29 18:02:53 +0000166 echo "Warning: Old Wine RPM install detected. Do you want to remove it first?"
167 conf_yesno_answer "(yes/no) "
168 if [ "$ANSWER" = 'yes' ]; then
Andreas Mohr8bba9ba2000-08-28 21:32:08 +0000169 echo Starting wine rpm removal...
170 rpm -e wine; RET=$?
171 if [ $RET -eq 0 ]; then
172 echo Done.
173 else
Phil Colea7c48b12000-08-31 02:07:07 +0000174 echo "FAILED. Probably you aren't installing as root."
Andreas Mohr8724ea82000-11-25 01:23:32 +0000175 echo "Expect problems (library conflicts with existing install etc.)."
Andreas Mohr8bba9ba2000-08-28 21:32:08 +0000176 fi
177 else
178 echo "Sorry, I won't install Wine when an rpm version is still installed."
179 echo "(Wine support suffered from way too many conflicts)"
180 echo "Have a nice day !"
Ove Kaaven6e143b32000-10-31 00:59:01 +0000181 exit 1
Andreas Mohr8bba9ba2000-08-28 21:32:08 +0000182 fi
183 fi
184fi
185
Andreas Mohrde53c482001-04-09 18:32:16 +0000186# check whether wine binary still available
187if [ -n "`which wine`" ]; then
188 echo "Warning !! wine binary (still) found, which may indicate"
189 echo "a (conflicting) previous installation."
190 echo "You might want to abort and uninstall Wine first."
191 std_sleep
192fi
193
Ove Kaaven2043ba01999-04-18 13:16:29 +0000194# run the configure script, if necessary
195
Ove Kaavence2b7242000-03-04 19:13:52 +0000196if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
Ove Kaaven2043ba01999-04-18 13:16:29 +0000197then {
198 echo "I see that WINE has already been configured, so I'll skip that."
Andreas Mohr6dc00542000-12-05 03:53:51 +0000199 std_sleep
Ove Kaavence2b7242000-03-04 19:13:52 +0000200 # load configure results
201 . ./config.cache
Ove Kaaven2043ba01999-04-18 13:16:29 +0000202}
203else {
Ove Kaaven2043ba01999-04-18 13:16:29 +0000204 echo "Running configure..."
205 echo
Ove Kaavene1858882000-04-08 20:20:21 +0000206 if ! ./configure $CONFARGS
Ove Kaaven2043ba01999-04-18 13:16:29 +0000207 then {
208 echo
209 echo "Configure failed, aborting install."
210 rm -f config.cache
211 exit 1
212 }
213 fi
Ove Kaavence2b7242000-03-04 19:13:52 +0000214 # load configure results
215 . ./config.cache
Ove Kaaven2043ba01999-04-18 13:16:29 +0000216 # make sure X was found
Ove Kaavence2b7242000-03-04 19:13:52 +0000217 eval "$ac_cv_have_x"
218 if [ "$have_x" != "yes" ]
Ove Kaaven2043ba01999-04-18 13:16:29 +0000219 then {
220 echo "Install the X development headers and try again."
221 rm -f config.cache
222 exit 1
223 }
Ove Kaavence2b7242000-03-04 19:13:52 +0000224 elif [ "$ac_cv_header_X11_xpm_h" != "yes" ]
Ove Kaavenb822b842000-02-25 20:51:09 +0000225 then {
226 echo "Install the Xpm development headers and try again."
227 rm -f config.cache
228 exit 1
229 }
Ove Kaaven2043ba01999-04-18 13:16:29 +0000230 fi
231}
232fi
233
234# now do the compilation
235
236if [ -f wine ] && [ wine -nt Makefile ]
237then {
238 echo "Hmm, looks like WINE is already compiled. I'll skip that too, I guess."
Andreas Mohr6dc00542000-12-05 03:53:51 +0000239 std_sleep
Ove Kaaven2043ba01999-04-18 13:16:29 +0000240}
241else {
Ove Kaaven6e143b32000-10-31 00:59:01 +0000242 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever,"
243 echo "in the meantime..."
Ove Kaaven2043ba01999-04-18 13:16:29 +0000244 echo
Andreas Mohr6dc00542000-12-05 03:53:51 +0000245 std_sleep
Ove Kaaven2043ba01999-04-18 13:16:29 +0000246 if ! { make depend && make; }
247 then {
248 echo
249 echo "Compilation failed, aborting install."
250 exit 1
251 }
252 fi
253 echo
254}
255fi
256
257# and installation, if root
258
259if [ `whoami` != 'root' ]
260then {
261 echo "You aren't root, so I'll skip the make install."
Chris Morgana00cefb2001-01-18 20:29:21 +0000262
Ove Kaavene1858882000-04-08 20:20:21 +0000263 # setup to run from current directory
264 DLLPATH="$PWD/dlls"
265 if [ -z "$LD_LIBRARY_PATH" ]
266 then LD_LIBRARY_PATH="$PWD:$DLLPATH"
267 else LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD:$DLLPATH"
268 fi
269 export LD_LIBRARY_PATH
Ove Kaaven91ae8cb2000-07-23 13:32:04 +0000270 DEBUGGER="$PWD/$HDEBUGGER"
Ove Kaavene1858882000-04-08 20:20:21 +0000271 echo
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."
Chris Morgana00cefb2001-01-18 20:29:21 +0000275 echo
276
277 # see if wine is installed on the users system, if not prompt them
278 # and then exit
279 if [ ! `which wine` ]
280 then
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."
283 echo
284 echo "Exiting wineinstall"
285 exit 1;
286 fi
Ove Kaaven2043ba01999-04-18 13:16:29 +0000287}
288else {
289 echo "Now installing binaries onto the system..."
290 echo
Andreas Mohr6dc00542000-12-05 03:53:51 +0000291 std_sleep
Ove Kaaven2043ba01999-04-18 13:16:29 +0000292 if ! make install
293 then {
294 echo
295 echo "Installation failed, aborting."
296 exit 1
297 }
298 fi
Ove Kaavene1858882000-04-08 20:20:21 +0000299 if [ -f /etc/ld.so.conf ] && ! grep -qs "$libdir" /etc/ld.so.conf
Ove Kaavenb822b842000-02-25 20:51:09 +0000300 then {
301 echo
Ove Kaavene1858882000-04-08 20:20:21 +0000302 echo "$libdir didn't exist in your /etc/ld.so.conf, adding it now..."
303 echo "$libdir" >>/etc/ld.so.conf
Ove Kaavenb822b842000-02-25 20:51:09 +0000304 echo "Re-running ldconfig..."
Ove Kaavence2b7242000-03-04 19:13:52 +0000305 eval "$ac_cv_path_LDCONFIG"
Ove Kaavenb822b842000-02-25 20:51:09 +0000306 }
307 fi
Ove Kaaven2043ba01999-04-18 13:16:29 +0000308}
309fi
Ove Kaaven2043ba01999-04-18 13:16:29 +0000310
Ove Kaavene1858882000-04-08 20:20:21 +0000311}
312fi # BINDIST
313
Chris Morgana00cefb2001-01-18 20:29:21 +0000314# now check whether we should generate wine.conf
315if [ -z "$DOGLOBALCONF" ]
316then DOGLOBALCONF=auto
Ove Kaaven2043ba01999-04-18 13:16:29 +0000317fi
318
Chris Morgana00cefb2001-01-18 20:29:21 +0000319if [ "$DOGLOBALCONF" = 'auto' ]
Ove Kaaven2043ba01999-04-18 13:16:29 +0000320then {
Chris Morgana00cefb2001-01-18 20:29:21 +0000321 # see if we already have a system wine.conf
322 if [ ! -f $GCONF ] && [ `whoami` = 'root' ]
323 then
324 DOGLOBALCONF=no
325 echo "Creation of a global config file is not supported in wineinstall at this"
326 echo "time. When the configuration architecture is cleaned up this functionality"
327 echo "will be restored to wineinstall."
328 echo
Ove Kaaven2043ba01999-04-18 13:16:29 +0000329 fi
330}
331fi
332
Chris Morgana00cefb2001-01-18 20:29:21 +0000333if [ "$DOLOCALCONF" = 'auto' ]
Ove Kaaven2043ba01999-04-18 13:16:29 +0000334then {
Chris Morgana00cefb2001-01-18 20:29:21 +0000335 # see if the user is root, if so, explicitly ask them if they want a
336 # local config file
337 if [ `whoami` = 'root' ]
338 then
339 echo "You are running as root. Do you want a local config file,"
340 echo "file, ~/.wine/config, created?"
341 conf_yesno_answer "(yes/no) "
342 DOLOCALCONF="$ANSWER"
343 else
344 echo "Create local config file ~/.wine/config?"
345 conf_yesno_answer "(yes/no) "
346 echo
347 DOLOCALCONF="$ANSWER"
348 if [ "$ANSWER" = 'no' ]
349 then
350 conf_question high need_root \
351 "Aborting install. Try again as root to generate a system wine.conf."
352 exit 1
Ove Kaaven2043ba01999-04-18 13:16:29 +0000353 fi
Chris Morgana00cefb2001-01-18 20:29:21 +0000354 fi
355
356 if [ -f "$LCONF" ]
357 then
358 echo "Found existing $LCONF, if you continue this file will be"
359 echo "overwritten. Continue running wineinstall?"
360 conf_yesno_answer "(yes/no) "
361 echo
362 if [ "$ANSWER" = 'no' ]
363 then
364 echo "Exiting wineinstall"
365 exit 1
366 fi
Ove Kaaven2043ba01999-04-18 13:16:29 +0000367 fi
368}
369fi
370
Chris Morgana00cefb2001-01-18 20:29:21 +0000371# generate $TMPCONF from existing windows install, if any
372if [ "$DOLOCALCONF" = 'yes' ]
Ove Kaaven2043ba01999-04-18 13:16:29 +0000373then {
Ove Kaavene1858882000-04-08 20:20:21 +0000374 if [ "$DOWCHK" = 'yes' ] || [ "$DOWCHK" = 'auto' ]
375 then {
Ove Kaaven2c767522000-10-29 18:02:53 +0000376 echo -n "Searching for an existing Windows installation..."
Chris Morgana00cefb2001-01-18 20:29:21 +0000377 if ! $WINECONF -inifile "$WINEINI" > $TMPCONF 2>/dev/null
Ove Kaavene1858882000-04-08 20:20:21 +0000378 then {
Chris Morgana00cefb2001-01-18 20:29:21 +0000379 rm -f $TMPCONF $TMPREG > /dev/null
380
Ove Kaaven2c767522000-10-29 18:02:53 +0000381 echo " not found."
382 conf_question low do_without_windows \
Ove Kaaven6e143b32000-10-31 00:59:01 +0000383 "Windows was not found on your system, so I assume you want" \
384 "a Wine-only installation. Am I correct?"
Ove Kaaven2c767522000-10-29 18:02:53 +0000385 conf_yesno_answer "(yes/no) "
386 if [ "$ANSWER" = 'no' ]
Ove Kaavene1858882000-04-08 20:20:21 +0000387 then {
Ove Kaaven2c767522000-10-29 18:02:53 +0000388 conf_question high windows_not_found \
389 "Aborting install. Make sure your Windows partition is mounted and try again," \
Chris Morgana00cefb2001-01-18 20:29:21 +0000390 "or create $LCONF manually by copying from $WINEINI and adapting the drive paths."
Ove Kaavene1858882000-04-08 20:20:21 +0000391 exit 1
392 }
393 fi
Ove Kaaven2c767522000-10-29 18:02:53 +0000394 DOWINE=yes
Ove Kaavene1858882000-04-08 20:20:21 +0000395 }
396 else {
Ove Kaaven2c767522000-10-29 18:02:53 +0000397 echo " found."
Chris Morgana00cefb2001-01-18 20:29:21 +0000398
Ove Kaaven6e143b32000-10-31 00:59:01 +0000399 conf_reset_question windows_found
Ove Kaaven2c767522000-10-29 18:02:53 +0000400 conf_question low windows_found \
Chris Morgana00cefb2001-01-18 20:29:21 +0000401 "Created $LCONF using your existing Windows installation." \
Ove Kaaven2c767522000-10-29 18:02:53 +0000402 "You probably want to review the file, though."
Ove Kaavene1858882000-04-08 20:20:21 +0000403 DOWINE=no
404 }
405 fi
Ove Kaavene1858882000-04-08 20:20:21 +0000406 }
407 elif [ "$DOWINE" = 'auto' ]
408 then DOWINE=yes
409 fi
410}
411elif [ "$DOWINE" = 'auto' ]
Chris Morgana00cefb2001-01-18 20:29:21 +0000412then
413 DOWINE=no
Ove Kaavene1858882000-04-08 20:20:21 +0000414fi
415
Ove Kaavenb5d37ec2000-04-15 20:37:14 +0000416# setup a no-windows installation, if necessary
Ove Kaavene1858882000-04-08 20:20:21 +0000417if [ "$DOWINE" = 'yes' ]
418then {
Chris Morgana00cefb2001-01-18 20:29:21 +0000419 # set an appropriate DCROOT
Ove Kaavene1858882000-04-08 20:20:21 +0000420 if [ `whoami` != 'root' ]
421 then DCROOT=~/c
422 else DCROOT=/c
423 fi
Chris Morgana00cefb2001-01-18 20:29:21 +0000424
Chris Morgan3a213212001-01-11 20:18:06 +0000425 if [ -f ~/.winerc ]
Ove Kaavene1858882000-04-08 20:20:21 +0000426 then {
Chris Morgan3a213212001-01-11 20:18:06 +0000427 conf_question medium convert_config \
Chris Morgana00cefb2001-01-18 20:29:21 +0000428 "I found the old version Wine config file, .winerc, in your " \
Chris Morgan3a213212001-01-11 20:18:06 +0000429 "home directory. I can convert this to the new format or use the" \
430 "new default Wine config file. Convert?"
431 conf_yesno_answer "(yes/no) "
432 if [ "$ANSWER" = 'yes' ]
433 then {
434 WINEINI=~/.winerc
435 CONVCONF=yes
436 }
437 fi
438 }
Chris Morgana00cefb2001-01-18 20:29:21 +0000439 else {
440
441 conf_question low drivec_path \
442 "Configuring Wine without Windows." \
443 "Some fake Windows directories must be created, to hold any .ini files, DLLs," \
444 "start menu entries, and other things your applications may need to install." \
445 "Where would you like your fake C drive to be placed?"
446 while [ -z "$CROOT" ]
447 do {
448 conf_string_answer "(default is $DCROOT) "
449 [ -z "$ANSWER" ] && ANSWER="$DCROOT"
450 if ! [ -d "$ANSWER" ]
451 then {
452 if mkdir -p "$ANSWER"
453 then CROOT="$ANSWER"
454 else
455 echo "Directory $ANSWER can't be created !"
456 conf_reset_question drivec_path
457 fi
458 }
459 else CROOT="$ANSWER"
460 fi
461 }
462 done
463 echo "Configuring Wine for a no-windows install in $CROOT..."
464
465 create_windows_directories
466 }
Chris Morgan3a213212001-01-11 20:18:06 +0000467 fi
468
Chris Morgana00cefb2001-01-18 20:29:21 +0000469 # create $LCONF using the default config file $WINEINI
470 if [ "$DOLOCALCONF" = 'yes' ] && [ "$CONVCONF" = 'no' ]
Chris Morgan3a213212001-01-11 20:18:06 +0000471 then {
Chris Morgana00cefb2001-01-18 20:29:21 +0000472 sed "s|\"Path\" = \"/c\"\$|\"Path\" = \"${CROOT}\"|" $WINEINI > $TMPCONF
Ove Kaaven6e143b32000-10-31 00:59:01 +0000473 conf_reset_question default_config
Ove Kaaven2c767522000-10-29 18:02:53 +0000474 conf_question low default_config \
Chris Morgana00cefb2001-01-18 20:29:21 +0000475 "Created $LCONF using default Wine configuration." \
Ove Kaaven2c767522000-10-29 18:02:53 +0000476 "You probably want to review the file, though."
Ove Kaavene1858882000-04-08 20:20:21 +0000477 }
478 fi
Chris Morgan3a213212001-01-11 20:18:06 +0000479
Ove Kaaven91ae8cb2000-07-23 13:32:04 +0000480 # now we really should install the registry
481 if [ "$DOREG" = 'auto' ]
482 then DOREG=yes
483 fi
Ove Kaavene1858882000-04-08 20:20:21 +0000484}
Ove Kaaven2043ba01999-04-18 13:16:29 +0000485fi
486echo
487
Chris Morgana00cefb2001-01-18 20:29:21 +0000488#install the local config file $LCONF
489if [ "$DOLOCALCONF" = 'yes' ]
490then
491 if [ ! -w ~/.wine ]
492 then
493 mkdir ~/.wine
Chris Morgan3a213212001-01-11 20:18:06 +0000494 fi
Chris Morgana00cefb2001-01-18 20:29:21 +0000495
496 if [ "$CONVCONF" = 'no' ]
497 then
498 cp $TMPCONF $LCONF > /dev/null
499 fi
500else
501 DOREG=no
502fi
503
504#install the global config file $GCONF
505if [ "$DOGLOBALCONF" = 'yes' ]
506then
507 if [ ! -f $sysconfdir ]
508 then
509 mkdir -p $sysconfdir
510 fi
511
512 cp $TMPCONF $GCONF > /dev/null
Ove Kaavene1858882000-04-08 20:20:21 +0000513fi
514
515# check whether we need to install default registry
516# (not to be done if windows registry exists)
517if [ "$DOREG" = 'auto' ]
518then {
519 echo "Checking for real Windows registry..."
520 if [ -f "$CROOT/windows/system.dat" ]
521 then DOREG=no
522 elif [ -f "$CROOT/windows/system32/config/system" ]
523 then DOREG=no
524 else DOREG=yes
525 fi
526 if [ "$DOREG" = 'yes' ]
527 then echo "Not found, default Wine registry will be installed."
528 else echo "Windows registry found, will not install default Wine registry."
529 fi
530 echo
531}
532fi
533
Ove Kaaven2043ba01999-04-18 13:16:29 +0000534# install default registry entries
535if [ "$DOREG" = 'yes' ]
536then {
Ove Kaavene1858882000-04-08 20:20:21 +0000537 if [ "$BINDIST" = 'no' ]
538 then {
539 echo "Compiling regapi..."
Ove Kaavene1858882000-04-08 20:20:21 +0000540 (cd programs/regapi; make)
541 echo
542 }
543 fi
Ove Kaavenf561aad2000-05-09 22:32:42 +0000544 echo "Preparing to install default Wine registry entries..."
545
Chris Morgana00cefb2001-01-18 20:29:21 +0000546 # edit config files so we don't have to run regapi under X
Chris Morgan3a213212001-01-11 20:18:06 +0000547 if [ "$CONVCONF" = 'yes' ]
548 then
Chris Morgana00cefb2001-01-18 20:29:21 +0000549 mv $WINEINI $WINEINI.new
550 sed "s/GraphicsDriver=.*/GraphicsDriver=ttydrv/" $WINEINI.new > $WINEINI
Chris Morgan3a213212001-01-11 20:18:06 +0000551 else
Chris Morgana00cefb2001-01-18 20:29:21 +0000552 mv $LCONF $LCONF.new
553 sed "s/\"GraphicsDriver\" = .*/\"GraphicsDriver\" = \"ttydrv\"/" $LCONF.new > $LCONF
Chris Morgan3a213212001-01-11 20:18:06 +0000554 fi
Ove Kaavenf561aad2000-05-09 22:32:42 +0000555
556 # create a temporary wineinstall.reg with fixed debugger path
Ove Kaaven2c767522000-10-29 18:02:53 +0000557 $DEFCAT $DEFREG | sed "s|debugger/winedbg|${DEBUGGER}|" > $TMPREG
Ove Kaavenf561aad2000-05-09 22:32:42 +0000558
Ove Kaavene1858882000-04-08 20:20:21 +0000559 echo "Installing default Wine registry entries..."
Ove Kaaven2043ba01999-04-18 13:16:29 +0000560 echo
Chris Morgana00cefb2001-01-18 20:29:21 +0000561 if ! $REGAPI setValue < $TMPREG > /dev/null
Ove Kaaven2043ba01999-04-18 13:16:29 +0000562 then {
Chris Morgana00cefb2001-01-18 20:29:21 +0000563 rm -f $TMPREG
Ove Kaavenf561aad2000-05-09 22:32:42 +0000564 echo "Registry install failed."
Ove Kaaven6e143b32000-10-31 00:59:01 +0000565 conf_reset_question regapi_error
Ove Kaaven2c767522000-10-29 18:02:53 +0000566 conf_question high regapi_error
Ove Kaavenb822b842000-02-25 20:51:09 +0000567 exit 1
Ove Kaaven2043ba01999-04-18 13:16:29 +0000568 }
Chris Morgan3a213212001-01-11 20:18:06 +0000569 else {
Chris Morgana00cefb2001-01-18 20:29:21 +0000570 # if we are converting from a .winerc file, running regapi once
571 # will ONLY convert .winerc -> ~/.wine/config, it will not import the
572 # registry data. so if we are converting we need to run regapi twice
573 if [ "$CONVCONF" = 'yes' ]
574 then
575 if ! $REGAPI setValue < $TMPREG > /dev/null
576 then
577 rm -f $TMPREG
578 echo "Registry install failed."
579 conf_reset_question regapi_error
580 conf_question high regapi_error
581 exit 1
582 else
583 echo
584 echo "Registry entries successfully installed."
585 fi
586 else
587 echo
588 echo "Registry entries successfully installed."
589 fi
Chris Morgan3a213212001-01-11 20:18:06 +0000590 }
Ove Kaaven2043ba01999-04-18 13:16:29 +0000591 fi
Chris Morgana00cefb2001-01-18 20:29:21 +0000592 rm -f $TMPREG
Ove Kaavenb5d37ec2000-04-15 20:37:14 +0000593 if [ "$SYSREG" = 'auto' ]
594 then SYSREG=yes
595 fi
Chris Morgan3a213212001-01-11 20:18:06 +0000596
Chris Morgana00cefb2001-01-18 20:29:21 +0000597 # if we converted we need to change the graphics driver back and
598 # restore the original .winerc file
Chris Morgan3a213212001-01-11 20:18:06 +0000599 if [ "$CONVCONF" = 'yes' ]
600 then
Chris Morgana00cefb2001-01-18 20:29:21 +0000601 mv $WINEINI.new $WINEINI
Chris Morgan3a213212001-01-11 20:18:06 +0000602 fi
Chris Morgana00cefb2001-01-18 20:29:21 +0000603
604 sed "s/\"GraphicsDriver\" = .*/\"GraphicsDriver\" = \"x11drv\"/" $LCONF > $LCONF.new
605 mv $LCONF.new $LCONF
Ove Kaaven2043ba01999-04-18 13:16:29 +0000606}
607fi
Ove Kaavenb5d37ec2000-04-15 20:37:14 +0000608
609# make root's registry global, if desired
Chris Morgan3a213212001-01-11 20:18:06 +0000610if [ `whoami` = 'root' ] && [ "$DOREG" = 'yes' ] && [ "$SYSREG" = 'yes' ]
Ove Kaavenb5d37ec2000-04-15 20:37:14 +0000611then {
Ove Kaaven91ae8cb2000-07-23 13:32:04 +0000612 [ -d ~/.wine ] || mkdir ~/.wine
Ove Kaavenb5d37ec2000-04-15 20:37:14 +0000613 if ! [ -f $sysconfdir/wine.userreg ]
614 then {
615 echo "Linking root's user registry hive to the global registry..."
Ove Kaaven6e143b32000-10-31 00:59:01 +0000616 [ -f ~/.wine/wine.userreg ] && cp ~/.wine/wine.userreg $sysconfdir/wine.userreg
Ove Kaavenb5d37ec2000-04-15 20:37:14 +0000617 ln -sf $sysconfdir/wine.userreg ~/.wine/wine.userreg
618 }
619 fi
620 if ! [ -f $sysconfdir/wine.systemreg ]
621 then {
622 echo "Linking root's system registry hive to the global registry..."
Ove Kaaven6e143b32000-10-31 00:59:01 +0000623 [ -f ~/.wine/system.reg ] && cp ~/.wine/system.reg $sysconfdir/wine.systemreg
Ove Kaavenb5d37ec2000-04-15 20:37:14 +0000624 ln -sf $sysconfdir/wine.systemreg ~/.wine/system.reg
625 }
626 fi
627}
628fi
629
Chris Morgana00cefb2001-01-18 20:29:21 +0000630# cleanup any temporary files that may remain
631if [ -f $TMPCONF ]
632then rm -f $TMPCONF
633fi
634if [ -f $TMPREG ]
635then rm -f $TMPREG
636fi
637
638
Ove Kaavenb5d37ec2000-04-15 20:37:14 +0000639# it's a wrap
Ove Kaaven2043ba01999-04-18 13:16:29 +0000640echo
641echo "Installation complete for now. Good luck (this is still alpha software)."
Ove Kaavene1858882000-04-08 20:20:21 +0000642echo "If you have problems with WINE, please read the documentation first,"
643echo "as many kinds of potential problems are explained there."
Ove Kaaven6e143b32000-10-31 00:59:01 +0000644
645exit 0