wineinstall 5.21 KB
Newer Older
1
#!/bin/sh
2
# WINE Installation script
3
# Can do almost everything from compiling to configuring...
4
#
5
# Copyright 1999 Ove Kåven
6 7 8 9 10 11 12 13 14 15 16 17 18
#
# 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
19
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20
#
21

22
#--- defaults (change these if you are a packager)
23
CONFARGS=""                   # configure args, e.g. --prefix=/usr
24

25
std_sleep() {
26 27 28
  sleep 1
}

29
conf_yesno_answer() {
30 31 32 33 34 35 36 37 38
  unset ANSWER
  while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
  do {
    echo -n "$1"
    read ANSWER
  }
  done
}

39 40
# startup...

41
echo "Wine Installer v1.0"
42
echo
43

44
if [ ! -f configure ]
45
then
46 47
    if [ -f ../configure ]
    then {
48
      cd ..
49 50 51 52 53 54 55
    }
    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
56
fi
57

58
if [ -w / ]
59
then
60 61 62
    echo "You are running wineinstall as root, this is not advisable. Please rerun as a user."
    echo "Aborting."
    exit 1
63
fi
64

65 66
if [ ! -w . ]
then
67 68 69
    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
70
fi
71

72
# check whether RPM installed, and if it is, remove any old wine rpm.
73
if [ -x `which rpm 2>/dev/null` ]; then
74 75 76 77 78 79 80 81 82 83 84 85 86 87
    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
88
      else
89 90 91 92 93
        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
94
      fi
95
    fi
96
fi
97

98
# check whether wine binary still available
99
if [ -x `which wine 2>/dev/null` ] && [ -n "`wine --version 2>/dev/null`" ]
100
then
101 102 103
    echo "Warning !! wine binary (still) found, which may indicate"
    echo "a (conflicting) previous installation."
    echo "You might want to abort and uninstall Wine first."
104 105
    echo "(If you previously tried to install from source manually, "
    echo "run 'make uninstall' from the wine root directory)"
106
    std_sleep
107
fi
Andreas Mohr's avatar
Andreas Mohr committed
108

109 110 111 112 113 114 115 116 117 118 119
# 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

120
# run the configure script, if necessary
121

122 123 124
if [ -f Makefile ]
then
    echo "I see that Wine has already been configured, so I'll skip that."
125
    std_sleep
126
else
127 128
    echo "Running configure..."
    echo
129
    if ! ./configure $CONFARGS
130 131 132 133 134 135
    then {
      echo
      echo "Configure failed, aborting install."
      exit 1
    }
    fi
136
fi
137

138
# Now do the compilation and (optionally) installation
139

140 141 142 143 144
echo
echo "Compiling Wine. Grab a lunch or two, rent a video, or whatever,"
echo "in the meantime..."
echo
std_sleep
145

146 147 148 149 150
# try to just make wine, if this fails 'make depend' and try to remake
if ! { make; }
then
    if ! { make depend && make; }
    then
151
      echo
152 153 154 155
      echo "Compilation failed, aborting install."
      exit 1
    fi
fi
156

157
if [ "$ROOTINSTALL" = "no" ]
158
then
159
    exit 0
160
fi
161

162
echo
163
echo "Performing 'make install' as root to install binaries, enter root password"
164

165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
if ! su root -c "$sucommand"
then
    echo
    echo "Incorrect root password. If you are running Ubuntu or a similar distribution,"
    echo "'make install' needs to be run via the sudo wrapper, so trying that one now"
    if ! sudo 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"
         echo "http://bugs.winehq.org/"
         echo
         echo "Installation failed, aborting."
         exit 1
    fi
fi
183

184
# it's a wrap
185
echo
186 187
echo "Installation complete."
echo "If you have problems with Wine, please read the documentation first,"
188
echo "as many kinds of potential problems are explained there."
189 190

exit 0