-#!/bin/bash
+#!/bin/sh
# WINE Installation script
# Can do almost everything from compiling to configuring...
#
#--- defaults (change these if you are a packager)
CONFARGS="" # configure args, e.g. --prefix=/usr
-# functions
-
-function std_sleep {
+std_sleep() {
sleep 1
}
-function conf_yesno_answer {
+conf_yesno_answer() {
unset ANSWER
while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
do {
echo "Wine Installer v1.0"
echo
-if ! [ -f configure ]
+if [ ! -f configure ]
then
if [ -f ../configure ]
then {
fi
fi
-if [ `whoami` = 'root' ]
+if [ -w / ]
then
echo "You are running wineinstall as root, this is not advisable. Please rerun as a user."
echo "Aborting."
fi
# check whether RPM installed, and if it is, remove any old wine rpm.
-hash rpm &>/dev/null
-RET=$?
-if [ $RET -eq 0 ]; then
+if [ -x `which rpm 2>/dev/null` ]; 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) "
fi
# check whether wine binary still available
-if [ -n "`wine --version 2>/dev/null`" ]
+if [ -x `which wine 2>/dev/null` ] && [ -n "`wine --version 2>/dev/null`" ]
then
echo "Warning !! wine binary (still) found, which may indicate"
echo "a (conflicting) previous installation."
std_sleep
fi
+# Ask the user if they want to build and install Wine:
+echo
+echo "We need to install Wine as the root user. Do you want us to build Wine,"
+echo "'su root' and install Wine? Enter 'no' to build Wine without installing:"
+conf_yesno_answer "(yes/no) "
+ROOTINSTALL="$ANSWER"
+
+if [ "$ROOTINSTALL" = "yes" ]
+then sucommand="make install"
+fi
+
# run the configure script, if necessary
if [ -f Makefile ]
fi
fi
-# 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
-
-# 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) "
-ROOTINSTALL="$ANSWER"
-
-if [ "$ROOTINSTALL" = "yes" ]
-then sucommand="make install"
-fi
+# Now do the compilation and (optionally) installation
echo
echo "Compiling Wine. Grab a lunch or two, rent a video, or whatever,"