1999-04-18 13:16:29 +00:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
# WINE Installation script
|
2000-10-29 18:02:53 +00:00
|
|
|
|
# Can do almost everything from compiling to configuring...
|
2002-03-09 23:29:33 +00:00
|
|
|
|
#
|
|
|
|
|
# Copyright 1999 Ove K<>ven
|
|
|
|
|
#
|
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
# License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-09 23:29:33 +00:00
|
|
|
|
#
|
1999-04-18 13:16:29 +00:00
|
|
|
|
|
2000-05-09 22:32:42 +00:00
|
|
|
|
#--- defaults (change these if you are a packager)
|
2005-07-05 10:58:20 +00:00
|
|
|
|
CONFARGS="" # configure args, e.g. --prefix=/usr
|
2000-04-08 20:20:21 +00:00
|
|
|
|
prefix=/usr/local # installation prefix
|
2002-09-06 19:46:27 +00:00
|
|
|
|
bindir=$prefix/bin # where winelib apps will be (or are) installed
|
2000-04-15 20:37:14 +00:00
|
|
|
|
libdir=$prefix/lib # where libwine.so will be (or is) installed
|
2000-04-08 20:20:21 +00:00
|
|
|
|
BINDIST=no # whether called from a binary package config script
|
1999-04-18 13:16:29 +00:00
|
|
|
|
|
2000-10-29 18:02:53 +00:00
|
|
|
|
# functions
|
|
|
|
|
|
2000-12-05 03:53:51 +00:00
|
|
|
|
function std_sleep {
|
|
|
|
|
sleep 1
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-29 18:02:53 +00:00
|
|
|
|
function conf_question {
|
|
|
|
|
# parameters: $1 = importance, $2 = question-id, $3+ = message lines
|
|
|
|
|
# the first two parameters can be used by e.g. debconf in debian packages
|
|
|
|
|
# but here we just print the message
|
|
|
|
|
shift 2
|
|
|
|
|
echo
|
|
|
|
|
local LINE="$1"
|
2005-03-01 10:38:23 +00:00
|
|
|
|
while [ $# -gt 0 ] && shift
|
2000-10-29 18:02:53 +00:00
|
|
|
|
do {
|
|
|
|
|
echo "$LINE"
|
|
|
|
|
LINE="$1"
|
|
|
|
|
}
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-31 00:59:01 +00:00
|
|
|
|
function conf_reset_question {
|
|
|
|
|
# parameters: $1 = question-id
|
|
|
|
|
# this is used to flush any cached answers and "already-displayed" flags
|
|
|
|
|
shift # dummy command
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-29 18:02:53 +00:00
|
|
|
|
function conf_yesno_answer {
|
|
|
|
|
unset ANSWER
|
|
|
|
|
while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
|
|
|
|
|
do {
|
|
|
|
|
echo -n "$1"
|
|
|
|
|
read ANSWER
|
|
|
|
|
}
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function conf_string_answer {
|
|
|
|
|
echo -n "$1"
|
|
|
|
|
read ANSWER
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-18 13:16:29 +00:00
|
|
|
|
# startup...
|
|
|
|
|
|
2005-07-05 10:58:20 +00:00
|
|
|
|
echo "WINE Installer v0.75"
|
1999-04-18 13:16:29 +00:00
|
|
|
|
echo
|
2000-04-08 20:20:21 +00:00
|
|
|
|
|
|
|
|
|
if [ "$BINDIST" = 'no' ]
|
|
|
|
|
then {
|
|
|
|
|
|
2002-05-23 16:30:42 +00:00
|
|
|
|
if ! [ -f configure ]
|
|
|
|
|
then {
|
2002-10-13 17:53:47 +00:00
|
|
|
|
if [ -f ../configure ]
|
|
|
|
|
then {
|
|
|
|
|
pushd ..
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "You're running this from the wrong directory."
|
|
|
|
|
echo "Change to the Wine source's main directory and try again."
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
fi
|
2002-05-23 16:30:42 +00:00
|
|
|
|
}
|
|
|
|
|
fi
|
1999-04-18 13:16:29 +00:00
|
|
|
|
|
2004-03-02 20:53:05 +00:00
|
|
|
|
if [ `whoami` = 'root' ]
|
2002-05-23 16:30:42 +00:00
|
|
|
|
then {
|
|
|
|
|
echo "You are running wineinstall as root, this is not advisable. Please rerun as a user."
|
|
|
|
|
echo "Aborting."
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
fi
|
2002-04-01 20:56:51 +00:00
|
|
|
|
|
2003-09-29 20:25:47 +00:00
|
|
|
|
if [ ! -w . ]
|
|
|
|
|
then {
|
|
|
|
|
echo "The source directory is not writable. You probably extracted the sources as root."
|
|
|
|
|
echo "You should remove the source tree and extract it again as a normal user."
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
fi
|
|
|
|
|
|
2002-05-23 16:30:42 +00:00
|
|
|
|
# check whether RPM installed, and if it is, remove any old wine rpm.
|
|
|
|
|
hash rpm &>/dev/null
|
|
|
|
|
RET=$?
|
|
|
|
|
if [ $RET -eq 0 ]; then
|
|
|
|
|
if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name"`" ]; then
|
|
|
|
|
echo "Warning: Old Wine RPM install detected. Do you want to remove it first?"
|
|
|
|
|
conf_yesno_answer "(yes/no) "
|
|
|
|
|
if [ "$ANSWER" = 'yes' ]; then
|
|
|
|
|
echo "We need to remove the rpm as root, please enter your root password"
|
|
|
|
|
echo
|
|
|
|
|
echo Starting wine rpm removal...
|
|
|
|
|
su -c "rpm -e wine; RET=$?"
|
|
|
|
|
if [ $RET -eq 0 ]; then
|
|
|
|
|
echo Done.
|
|
|
|
|
else
|
|
|
|
|
echo "FAILED. Probably you aren't installing as root."
|
|
|
|
|
echo "Expect problems (library conflicts with existing install etc.)."
|
|
|
|
|
fi
|
2000-08-28 21:32:08 +00:00
|
|
|
|
else
|
2002-05-23 16:30:42 +00:00
|
|
|
|
echo "Sorry, I won't install Wine when an rpm version is still installed."
|
|
|
|
|
echo "(Wine support suffered from way too many conflicts between RPM"
|
|
|
|
|
echo "and source installs)"
|
|
|
|
|
echo "Have a nice day !"
|
|
|
|
|
exit 1
|
2000-08-28 21:32:08 +00:00
|
|
|
|
fi
|
2002-05-23 16:30:42 +00:00
|
|
|
|
fi
|
2000-08-28 21:32:08 +00:00
|
|
|
|
fi
|
|
|
|
|
|
2002-05-23 16:30:42 +00:00
|
|
|
|
# check whether wine binary still available
|
|
|
|
|
if [ -n "`which wine 2>/dev/null|grep '/wine'`" ]; then
|
|
|
|
|
echo "Warning !! wine binary (still) found, which may indicate"
|
|
|
|
|
echo "a (conflicting) previous installation."
|
|
|
|
|
echo "You might want to abort and uninstall Wine first."
|
2005-02-23 20:57:14 +00:00
|
|
|
|
echo "(If you previously tried to install from source manually, "
|
|
|
|
|
echo "run 'make uninstall' from the wine root directory)"
|
2002-05-23 16:30:42 +00:00
|
|
|
|
std_sleep
|
|
|
|
|
fi
|
2001-04-09 18:32:16 +00:00
|
|
|
|
|
2002-05-23 16:30:42 +00:00
|
|
|
|
# run the configure script, if necessary
|
1999-04-18 13:16:29 +00:00
|
|
|
|
|
2002-05-23 16:30:42 +00:00
|
|
|
|
if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
|
1999-04-18 13:16:29 +00:00
|
|
|
|
then {
|
|
|
|
|
echo
|
2002-05-23 16:30:42 +00:00
|
|
|
|
echo "I see that WINE has already been configured, so I'll skip that."
|
|
|
|
|
std_sleep
|
|
|
|
|
# load configure results
|
|
|
|
|
. ./config.cache
|
1999-04-18 13:16:29 +00:00
|
|
|
|
}
|
2002-05-23 16:30:42 +00:00
|
|
|
|
else {
|
|
|
|
|
echo "Running configure..."
|
|
|
|
|
echo
|
2003-05-13 23:37:09 +00:00
|
|
|
|
if ! ./configure -C $CONFARGS --prefix=$prefix
|
2002-05-23 16:30:42 +00:00
|
|
|
|
then {
|
|
|
|
|
echo
|
|
|
|
|
echo "Configure failed, aborting install."
|
|
|
|
|
rm -f config.cache
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
fi
|
|
|
|
|
# load configure results
|
|
|
|
|
. ./config.cache
|
|
|
|
|
# make sure X was found
|
|
|
|
|
eval "$ac_cv_have_x"
|
|
|
|
|
if [ "$have_x" != "yes" ]
|
|
|
|
|
then {
|
|
|
|
|
echo "Install the X development headers and try again."
|
|
|
|
|
rm -f config.cache
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
fi
|
1999-04-18 13:16:29 +00:00
|
|
|
|
}
|
|
|
|
|
fi
|
2002-04-01 20:56:51 +00:00
|
|
|
|
|
2002-05-23 16:30:42 +00:00
|
|
|
|
# now do the compilation and install, we need to always do this because we
|
|
|
|
|
# don't want the 'make install' command we might run to run 'make' as root
|
|
|
|
|
if [ `whoami` != 'root' ]
|
1999-04-18 13:16:29 +00:00
|
|
|
|
then {
|
2002-05-23 16:30:42 +00:00
|
|
|
|
# ask the user if they want to build and install wine
|
|
|
|
|
echo
|
|
|
|
|
echo "We need to install wine as root user, do you want us to build wine,"
|
|
|
|
|
echo "'su root' and install Wine? Enter 'no' to continue without installing"
|
|
|
|
|
conf_yesno_answer "(yes/no) "
|
2002-10-15 01:19:46 +00:00
|
|
|
|
ROOTINSTALL="$ANSWER"
|
1999-04-18 13:16:29 +00:00
|
|
|
|
|
2002-10-15 01:19:46 +00:00
|
|
|
|
if [ "$ROOTINSTALL" = "yes" ]
|
2002-05-23 16:30:42 +00:00
|
|
|
|
then {
|
|
|
|
|
# start out with the basic command
|
|
|
|
|
sucommand="make install"
|
|
|
|
|
|
|
|
|
|
# if the user doesn't have $libdir in their ld.so.conf add this
|
|
|
|
|
# to our sucommand string
|
|
|
|
|
if [ -f /etc/ld.so.conf ]
|
|
|
|
|
then
|
2003-07-30 03:43:55 +00:00
|
|
|
|
if ! grep -s "$libdir" /etc/ld.so.conf >/dev/null 2>&1
|
2002-05-23 16:30:42 +00:00
|
|
|
|
then {
|
|
|
|
|
echo
|
|
|
|
|
echo "$libdir doesn't exist in your /etc/ld.so.conf, it will be added"
|
|
|
|
|
echo "when we perform the install..."
|
|
|
|
|
sucommand="$sucommand;echo $libdir>>/etc/ld.so.conf"
|
|
|
|
|
}
|
|
|
|
|
fi
|
2004-01-06 22:08:33 +00:00
|
|
|
|
# run ldconfig always just in case some updated files don't get linked
|
2002-05-23 16:30:42 +00:00
|
|
|
|
sucommand="$sucommand;$ac_cv_path_LDCONFIG"
|
|
|
|
|
fi
|
2002-10-15 01:19:46 +00:00
|
|
|
|
}
|
|
|
|
|
fi # [ "$ROOTINSTALL" = "yes" ]
|
2002-05-23 16:30:42 +00:00
|
|
|
|
|
2002-10-15 01:19:46 +00:00
|
|
|
|
echo
|
2002-05-23 16:30:42 +00:00
|
|
|
|
|
2002-10-15 01:19:46 +00:00
|
|
|
|
echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever,"
|
|
|
|
|
echo "in the meantime..."
|
|
|
|
|
echo
|
|
|
|
|
std_sleep
|
2002-05-23 16:30:42 +00:00
|
|
|
|
|
2002-10-15 01:19:46 +00:00
|
|
|
|
# try to just make wine, if this fails 'make depend' and try to remake
|
|
|
|
|
if ! { make; }
|
|
|
|
|
then {
|
|
|
|
|
if ! { make depend && make; }
|
2002-04-27 00:15:12 +00:00
|
|
|
|
then {
|
2002-10-15 01:19:46 +00:00
|
|
|
|
echo
|
|
|
|
|
echo "Compilation failed, aborting install."
|
|
|
|
|
exit 1
|
2002-04-27 00:15:12 +00:00
|
|
|
|
}
|
|
|
|
|
fi
|
2002-10-15 01:19:46 +00:00
|
|
|
|
}
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$ROOTINSTALL" = "yes" ]
|
|
|
|
|
then {
|
2002-05-23 16:30:42 +00:00
|
|
|
|
echo
|
1999-04-18 13:16:29 +00:00
|
|
|
|
|
2002-05-23 16:30:42 +00:00
|
|
|
|
echo "Performing 'make install' as root to install binaries, enter root password"
|
2001-01-18 20:29:21 +00:00
|
|
|
|
|
2002-05-23 16:30:42 +00:00
|
|
|
|
std_sleep
|
2001-01-18 20:29:21 +00:00
|
|
|
|
|
2002-05-23 16:30:42 +00:00
|
|
|
|
if ! su root -c "$sucommand"
|
2002-04-01 20:56:51 +00:00
|
|
|
|
then {
|
2003-03-24 19:29:38 +00:00
|
|
|
|
if ! su root -c "$sucommand"
|
|
|
|
|
then {
|
|
|
|
|
echo
|
|
|
|
|
echo "Either you entered an incorrect password or we failed to"
|
|
|
|
|
echo "run '$sucommand' correctly."
|
|
|
|
|
echo "If you didn't enter an incorrect password then please"
|
|
|
|
|
echo "report this error and any steps to possibly reproduce it to"
|
2003-11-26 03:55:01 +00:00
|
|
|
|
echo "http://bugs.winehq.org/"
|
2003-03-24 19:29:38 +00:00
|
|
|
|
echo
|
|
|
|
|
echo "Installation failed, aborting."
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
fi
|
|
|
|
|
}
|
2002-04-01 20:56:51 +00:00
|
|
|
|
fi
|
|
|
|
|
|
2002-05-23 16:30:42 +00:00
|
|
|
|
echo
|
2002-04-01 20:56:51 +00:00
|
|
|
|
|
2002-05-23 16:30:42 +00:00
|
|
|
|
# see if wine is installed on the users system, if not prompt them
|
|
|
|
|
# and then exit
|
|
|
|
|
if [ ! `which wine` ]
|
|
|
|
|
then
|
|
|
|
|
echo "Could not find wine on your system. Run wineinstall as root to install wine"
|
|
|
|
|
echo "before re-running wineinstall as a user."
|
|
|
|
|
echo
|
|
|
|
|
echo "Exiting wineinstall"
|
|
|
|
|
exit 1;
|
|
|
|
|
fi
|
2002-11-21 00:03:14 +00:00
|
|
|
|
|
|
|
|
|
WINEINSTALLED=yes
|
2002-05-23 16:30:42 +00:00
|
|
|
|
}
|
|
|
|
|
else {
|
2002-11-21 00:03:14 +00:00
|
|
|
|
WINEINSTALLED=no
|
2002-04-01 20:56:51 +00:00
|
|
|
|
}
|
2002-10-15 01:19:46 +00:00
|
|
|
|
fi # [ "$ROOTINSTALL" = "yes" ]
|
2000-02-25 20:51:09 +00:00
|
|
|
|
}
|
2002-05-23 16:30:42 +00:00
|
|
|
|
fi # [ `whoami` != 'root' ]
|
1999-04-18 13:16:29 +00:00
|
|
|
|
|
2000-04-08 20:20:21 +00:00
|
|
|
|
}
|
|
|
|
|
fi # BINDIST
|
|
|
|
|
|
2005-07-05 10:58:20 +00:00
|
|
|
|
if [ "$WINEINSTALLED" = 'no' ]
|
|
|
|
|
then
|
|
|
|
|
tools/wineprefixcreate --use-wine-tree .
|
|
|
|
|
else
|
|
|
|
|
wineprefixcreate
|
2001-01-18 20:29:21 +00:00
|
|
|
|
fi
|
2005-07-05 10:58:20 +00:00
|
|
|
|
echo
|
2001-01-18 20:29:21 +00:00
|
|
|
|
|
|
|
|
|
|
2000-04-15 20:37:14 +00:00
|
|
|
|
# it's a wrap
|
1999-04-18 13:16:29 +00:00
|
|
|
|
echo
|
2005-10-27 12:08:24 +00:00
|
|
|
|
echo "Installation complete for now. Good luck (this is still beta software)."
|
2000-04-08 20:20:21 +00:00
|
|
|
|
echo "If you have problems with WINE, please read the documentation first,"
|
|
|
|
|
echo "as many kinds of potential problems are explained there."
|
2000-10-31 00:59:01 +00:00
|
|
|
|
|
|
|
|
|
exit 0
|