winecfg: Dutch resources update.
[wine/multimedia.git] / tools / wineinstall
blob7dd96a0ede66abb682ba3557e4cc39d5d5f3b83f
1 #!/bin/bash
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
24 prefix=/usr/local # installation prefix
25 bindir=$prefix/bin # where winelib apps will be (or are) installed
26 libdir=$prefix/lib # where libwine.so will be (or is) installed
27 BINDIST=no # whether called from a binary package config script
29 # functions
31 function std_sleep {
32 sleep 1
35 function conf_question {
36 # parameters: $1 = importance, $2 = question-id, $3+ = message lines
37 # the first two parameters can be used by e.g. debconf in debian packages
38 # but here we just print the message
39 shift 2
40 echo
41 local LINE="$1"
42 while [ $# -gt 0 ] && shift
43 do {
44 echo "$LINE"
45 LINE="$1"
47 done
50 function conf_reset_question {
51 # parameters: $1 = question-id
52 # this is used to flush any cached answers and "already-displayed" flags
53 shift # dummy command
56 function conf_yesno_answer {
57 unset ANSWER
58 while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
59 do {
60 echo -n "$1"
61 read ANSWER
63 done
66 function conf_string_answer {
67 echo -n "$1"
68 read ANSWER
71 # startup...
73 echo "WINE Installer v0.75"
74 echo
76 if [ "$BINDIST" = 'no' ]
77 then {
79 if ! [ -f configure ]
80 then {
81 if [ -f ../configure ]
82 then {
83 pushd ..
85 else {
86 echo "You're running this from the wrong directory."
87 echo "Change to the Wine source's main directory and try again."
88 exit 1
94 if [ `whoami` = 'root' ]
95 then {
96 echo "You are running wineinstall as root, this is not advisable. Please rerun as a user."
97 echo "Aborting."
98 exit 1
102 if [ ! -w . ]
103 then {
104 echo "The source directory is not writable. You probably extracted the sources as root."
105 echo "You should remove the source tree and extract it again as a normal user."
106 exit 1
110 # check whether RPM installed, and if it is, remove any old wine rpm.
111 hash rpm &>/dev/null
112 RET=$?
113 if [ $RET -eq 0 ]; then
114 if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name"`" ]; then
115 echo "Warning: Old Wine RPM install detected. Do you want to remove it first?"
116 conf_yesno_answer "(yes/no) "
117 if [ "$ANSWER" = 'yes' ]; then
118 echo "We need to remove the rpm as root, please enter your root password"
119 echo
120 echo Starting wine rpm removal...
121 su -c "rpm -e wine; RET=$?"
122 if [ $RET -eq 0 ]; then
123 echo Done.
124 else
125 echo "FAILED. Probably you aren't installing as root."
126 echo "Expect problems (library conflicts with existing install etc.)."
128 else
129 echo "Sorry, I won't install Wine when an rpm version is still installed."
130 echo "(Wine support suffered from way too many conflicts between RPM"
131 echo "and source installs)"
132 echo "Have a nice day !"
133 exit 1
138 # check whether wine binary still available
139 if [ -n "`which wine 2>/dev/null|grep '/wine'`" ]; then
140 echo "Warning !! wine binary (still) found, which may indicate"
141 echo "a (conflicting) previous installation."
142 echo "You might want to abort and uninstall Wine first."
143 echo "(If you previously tried to install from source manually, "
144 echo "run 'make uninstall' from the wine root directory)"
145 std_sleep
148 # run the configure script, if necessary
150 if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
151 then {
152 echo
153 echo "I see that WINE has already been configured, so I'll skip that."
154 std_sleep
155 # load configure results
156 . ./config.cache
158 else {
159 echo "Running configure..."
160 echo
161 if ! ./configure -C $CONFARGS --prefix=$prefix
162 then {
163 echo
164 echo "Configure failed, aborting install."
165 rm -f config.cache
166 exit 1
169 # load configure results
170 . ./config.cache
171 # make sure X was found
172 eval "$ac_cv_have_x"
173 if [ "$have_x" != "yes" ]
174 then {
175 echo "Install the X development headers and try again."
176 rm -f config.cache
177 exit 1
183 # now do the compilation and install, we need to always do this because we
184 # don't want the 'make install' command we might run to run 'make' as root
185 if [ `whoami` != 'root' ]
186 then {
187 # ask the user if they want to build and install wine
188 echo
189 echo "We need to install wine as root user, do you want us to build wine,"
190 echo "'su root' and install Wine? Enter 'no' to continue without installing"
191 conf_yesno_answer "(yes/no) "
192 ROOTINSTALL="$ANSWER"
194 if [ "$ROOTINSTALL" = "yes" ]
195 then {
196 # start out with the basic command
197 sucommand="make install"
199 # if the user doesn't have $libdir in their ld.so.conf add this
200 # to our sucommand string
201 if [ -f /etc/ld.so.conf ]
202 then
203 if ! grep -s "$libdir" /etc/ld.so.conf >/dev/null 2>&1
204 then {
205 echo
206 echo "$libdir doesn't exist in your /etc/ld.so.conf, it will be added"
207 echo "when we perform the install..."
208 sucommand="$sucommand;echo $libdir>>/etc/ld.so.conf"
211 # run ldconfig always just in case some updated files don't get linked
212 sucommand="$sucommand;$ac_cv_path_LDCONFIG"
215 fi # [ "$ROOTINSTALL" = "yes" ]
217 echo
219 echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever,"
220 echo "in the meantime..."
221 echo
222 std_sleep
224 # try to just make wine, if this fails 'make depend' and try to remake
225 if ! { make; }
226 then {
227 if ! { make depend && make; }
228 then {
229 echo
230 echo "Compilation failed, aborting install."
231 exit 1
237 if [ "$ROOTINSTALL" = "yes" ]
238 then {
239 echo
241 echo "Performing 'make install' as root to install binaries, enter root password"
243 std_sleep
245 if ! su root -c "$sucommand"
246 then {
247 if ! su root -c "$sucommand"
248 then {
249 echo
250 echo "Either you entered an incorrect password or we failed to"
251 echo "run '$sucommand' correctly."
252 echo "If you didn't enter an incorrect password then please"
253 echo "report this error and any steps to possibly reproduce it to"
254 echo "http://bugs.winehq.org/"
255 echo
256 echo "Installation failed, aborting."
257 exit 1
263 echo
265 # see if wine is installed on the users system, if not prompt them
266 # and then exit
267 if [ ! `which wine` ]
268 then
269 echo "Could not find wine on your system. Run wineinstall as root to install wine"
270 echo "before re-running wineinstall as a user."
271 echo
272 echo "Exiting wineinstall"
273 exit 1;
276 WINEINSTALLED=yes
278 else {
279 WINEINSTALLED=no
281 fi # [ "$ROOTINSTALL" = "yes" ]
283 fi # [ `whoami` != 'root' ]
286 fi # BINDIST
288 if [ "$WINEINSTALLED" = 'no' ]
289 then
290 tools/wineprefixcreate --use-wine-tree .
291 else
292 wineprefixcreate
294 echo
297 # it's a wrap
298 echo
299 echo "Installation complete for now. Good luck (this is still beta software)."
300 echo "If you have problems with WINE, please read the documentation first,"
301 echo "as many kinds of potential problems are explained there."
303 exit 0