clock: Update simplified Chinese resource.
[wine/wine64.git] / tools / wineinstall
blob636be558091dc6d3141eb51343345d4918a4d6be
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #--- defaults (change these if you are a packager)
23 CONFARGS="" # configure args, e.g. --prefix=/usr
25 # functions
27 function std_sleep {
28 sleep 1
31 function conf_yesno_answer {
32 unset ANSWER
33 while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
34 do {
35 echo -n "$1"
36 read ANSWER
38 done
41 # startup...
43 echo "Wine Installer v1.0"
44 echo
46 if ! [ -f configure ]
47 then
48 if [ -f ../configure ]
49 then {
50 cd ..
52 else {
53 echo "You're running this from the wrong directory."
54 echo "Change to the Wine source's main directory and try again."
55 exit 1
60 if [ `whoami` = 'root' ]
61 then
62 echo "You are running wineinstall as root, this is not advisable. Please rerun as a user."
63 echo "Aborting."
64 exit 1
67 if [ ! -w . ]
68 then
69 echo "The source directory is not writable. You probably extracted the sources as root."
70 echo "You should remove the source tree and extract it again as a normal user."
71 exit 1
74 # check whether RPM installed, and if it is, remove any old wine rpm.
75 hash rpm &>/dev/null
76 RET=$?
77 if [ $RET -eq 0 ]; then
78 if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name"`" ]; then
79 echo "Warning: Old Wine RPM install detected. Do you want to remove it first?"
80 conf_yesno_answer "(yes/no) "
81 if [ "$ANSWER" = 'yes' ]; then
82 echo "We need to remove the rpm as root, please enter your root password"
83 echo
84 echo Starting wine rpm removal...
85 su -c "rpm -e wine; RET=$?"
86 if [ $RET -eq 0 ]; then
87 echo Done.
88 else
89 echo "FAILED. Probably you aren't installing as root."
90 echo "Expect problems (library conflicts with existing install etc.)."
92 else
93 echo "Sorry, I won't install Wine when an rpm version is still installed."
94 echo "(Wine support suffered from way too many conflicts between RPM"
95 echo "and source installs)"
96 echo "Have a nice day !"
97 exit 1
102 # check whether wine binary still available
103 if [ -n "`wine --version 2>/dev/null`" ]
104 then
105 echo "Warning !! wine binary (still) found, which may indicate"
106 echo "a (conflicting) previous installation."
107 echo "You might want to abort and uninstall Wine first."
108 echo "(If you previously tried to install from source manually, "
109 echo "run 'make uninstall' from the wine root directory)"
110 std_sleep
113 # run the configure script, if necessary
115 if [ -f Makefile ]
116 then
117 echo "I see that Wine has already been configured, so I'll skip that."
118 std_sleep
119 else
120 echo "Running configure..."
121 echo
122 if ! ./configure $CONFARGS
123 then {
124 echo
125 echo "Configure failed, aborting install."
126 exit 1
131 # now do the compilation and install, we need to always do this because we
132 # don't want the 'make install' command we might run to run 'make' as root
134 # ask the user if they want to build and install wine
135 echo
136 echo "We need to install wine as root user, do you want us to build wine,"
137 echo "'su root' and install Wine? Enter 'no' to continue without installing"
138 conf_yesno_answer "(yes/no) "
139 ROOTINSTALL="$ANSWER"
141 if [ "$ROOTINSTALL" = "yes" ]
142 then sucommand="make install"
145 echo
146 echo "Compiling Wine. Grab a lunch or two, rent a video, or whatever,"
147 echo "in the meantime..."
148 echo
149 std_sleep
151 # try to just make wine, if this fails 'make depend' and try to remake
152 if ! { make; }
153 then
154 if ! { make depend && make; }
155 then
156 echo
157 echo "Compilation failed, aborting install."
158 exit 1
162 if [ "$ROOTINSTALL" = "no" ]
163 then
164 exit 0
167 echo
168 echo "Performing 'make install' as root to install binaries, enter root password"
170 if ! su root -c "$sucommand"
171 then
172 echo
173 echo "Incorrect root password. If you are running Ubuntu or a similar distribution,"
174 echo "'make install' needs to be run via the sudo wrapper, so trying that one now"
175 if ! sudo su root -c "$sucommand"
176 then
177 echo
178 echo "Either you entered an incorrect password or we failed to"
179 echo "run '$sucommand' correctly."
180 echo "If you didn't enter an incorrect password then please"
181 echo "report this error and any steps to possibly reproduce it to"
182 echo "http://bugs.winehq.org/"
183 echo
184 echo "Installation failed, aborting."
185 exit 1
189 # it's a wrap
190 echo
191 echo "Installation complete."
192 echo "If you have problems with Wine, please read the documentation first,"
193 echo "as many kinds of potential problems are explained there."
195 exit 0