File: wineinstall

package info (click to toggle)
wine 1.8.7-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 179,848 kB
  • ctags: 306,666
  • sloc: ansic: 2,517,827; perl: 18,150; yacc: 15,402; makefile: 7,623; objc: 5,762; lex: 4,207; sh: 893; cpp: 816; xml: 78; awk: 69
file content (190 lines) | stat: -rwxr-xr-x 5,333 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/bin/sh
# WINE Installation script
# Can do almost everything from compiling to configuring...
#
# 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
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#

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

std_sleep() {
  sleep 1
}

conf_yesno_answer() {
  unset ANSWER
  while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
  do {
    echo -n "$1"
    read ANSWER
  }
  done
}

# startup...

echo "Wine Installer v1.0"
echo

if [ ! -f configure ]
then
    if [ -f ../configure ]
    then {
      cd ..
    }
    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
fi

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

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

# check whether RPM installed, and if it is, remove any old wine rpm.
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) "
      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
      else
        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
      fi
    fi
fi

# check whether wine binary still available
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."
    echo "You might want to abort and uninstall Wine first."
    echo "(If you previously tried to install from source manually, "
    echo "run 'make uninstall' from the wine root directory)"
    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 ]
then
    echo "I see that Wine has already been configured, so I'll skip that."
    std_sleep
else
    echo "Running configure..."
    echo
    if ! ./configure $CONFARGS
    then {
      echo
      echo "Configure failed, aborting install."
      exit 1
    }
    fi
fi

# Now do the compilation and (optionally) installation

echo
echo "Compiling Wine. Grab a lunch or two, rent a video, or whatever,"
echo "in the meantime..."
echo
std_sleep

# try to just make wine, if this fails 'make depend' and try to remake
if ! { make; }
then
    if ! { make depend && make; }
    then
      echo
      echo "Compilation failed, aborting install."
      exit 1
    fi
fi

if [ "$ROOTINSTALL" = "no" ]
then
    exit 0
fi

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

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

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

exit 0