Create sysconfdir on install.
[wine] / tools / wineinstall
1 #!/bin/bash
2 # WINE Installation script
3
4 # Mar 31 1999 - Ove Kåven
5 #  First version
6
7 # defaults
8
9 sysconfdir=/usr/local/etc
10 DOCONF=auto
11 DOREG=yes
12
13 # startup...
14
15 echo "WINE Installer v0.1"
16 echo
17 if ! [ -f configure ]
18 then {
19   echo "You're running this from the wrong directory."
20   echo "Change to the Wine directory and try again."
21   exit 1
22 }
23 fi
24
25 # run the configure script, if necessary
26
27 if [ -f Makefile ] && [ Makefile -nt configure ]
28 then {
29   echo "I see that WINE has already been configured, so I'll skip that."
30 }
31 else {
32   # we'll run with defaults (we need libwine.a later)
33   echo "Running configure..."
34   echo
35   if ! ./configure
36   then {
37     echo
38     echo "Configure failed, aborting install."
39     rm -f config.cache
40     exit 1
41   }
42   fi
43   # make sure X was found
44   if ! grep -qs "have_x=yes" config.cache
45   then {
46     echo "Install the X development headers and try again."
47     rm -f config.cache
48     exit 1
49   }
50   fi
51 }
52 fi
53
54 # now do the compilation
55
56 if [ -f wine ] && [ wine -nt Makefile ]
57 then {
58   echo "Hmm, looks like WINE is already compiled. I'll skip that too, I guess."
59 }
60 else {
61   echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever, in the meantime..."
62   echo
63   if ! { make depend && make; }
64   then {
65     echo
66     echo "Compilation failed, aborting install."
67     exit 1
68   }
69   fi
70   echo
71 }
72 fi
73
74 # and installation, if root
75
76 if [ `whoami` != 'root' ]
77 then {
78   echo "You aren't root, so I'll skip the make install."
79 }
80 else {
81   echo "Now installing binaries onto the system..."
82   echo
83   if ! make install
84   then {
85     echo
86     echo "Installation failed, aborting."
87     exit 1
88   }
89   fi
90 }
91 fi
92 echo
93
94 # now check whether we should generate wine.conf
95 if [ -z "$DOCONF" ]
96 then DOCONF=auto
97 fi
98
99 if [ "$DOCONF" = 'auto' ]
100 then {
101   # see if we already have a system wine.conf
102   if [ -f $sysconfdir/wine.conf ] || [ -f /etc/wine.conf ]
103   then DOCONF=no
104   fi
105 }
106 fi
107
108 if [ "$DOCONF" != 'no' ]
109 then {
110   if [ `whoami` != 'root' ]
111   then {
112     CONF=~/.winerc
113     if ! [ -f $CONF ]
114     then {
115       if [ "$DOCONF" != 'yes' ]
116       then {
117         echo "Since you aren't root, and there's no system wine.conf, I assume"
118         echo "you want a user-specific .winerc. Am I correct? (yes/no)"
119         while [ "$DOCONF" != 'yes' ] && [ "$DOCONF" != 'no' ]
120         do read DOCONF
121         done
122       }
123       fi
124       if [ "$DOCONF" = 'no' ]
125       then echo "Skipping generation of .winerc."
126       fi
127     }
128     fi
129   }
130   else {
131     CONF=$sysconfdir/wine.conf
132     mkdir -p $sysconfdir
133     DOCONF=yes
134   }
135   fi
136 }
137 fi
138
139 if [ "$DOCONF" = 'yes' ]
140 then {
141   echo "Now automatically generating $CONF for you..."
142   echo
143   tools/wineconf > $CONF
144   echo
145   echo "Done. You probably want to review the file, though."
146 }
147 fi
148 echo
149
150 # install default registry entries
151 if [ "$DOREG" = 'yes' ]
152 then {
153   echo "Compiling regapi..."
154   echo
155   (cd programs/regapi; make)
156   echo
157   echo "Installing default registry entries, please wait..."
158   echo
159   if ! programs/regapi/regapi setValue < winedefault.reg
160   then {
161     echo
162     echo "Registry install failed. Perhaps you weren't running X."
163   }
164   fi
165 }
166 fi
167 echo
168 echo "Installation complete for now. Good luck (this is still alpha software)."
169 echo "If you have problems with WINE, please read the documentation first."