1 | #!/installer/root/bin/sh |
---|
2 | |
---|
3 | echo "[Starting phase 2 installer.]" |
---|
4 | cd $SYSTEM |
---|
5 | |
---|
6 | # clear up some space in / |
---|
7 | rm -f /tmp/syslog |
---|
8 | |
---|
9 | #### Important environment variables inherited from the miniroot are: |
---|
10 | #### SYSTEM, IPADDR, NETMASK, GATEWAY |
---|
11 | #### The latter three will not be set if DHCP addressing was used. |
---|
12 | |
---|
13 | #### Set defaults and useful environment variables. |
---|
14 | export TZ=US/Eastern |
---|
15 | umask 022 |
---|
16 | installer=$SYSTEM/installer |
---|
17 | instroot=${installer}/root |
---|
18 | root=/sysimage |
---|
19 | PATH=${instroot}/bin:${instroot}/usr/bin:${instroot}/sbin:${instroot}/usr/sbin:${root}/bin:${root}/usr/bin:${root}/sbin:${root}/usr/sbin:/bin:/sbin:/usr/bin:/etc/athena:/usr/X11R6/bin:$PATH |
---|
20 | LD_LIBRARY_PATH=${instroot}/lib:${instroot}/usr/lib:/lib:/usr/lib:/usr/X11R6/lib: |
---|
21 | export PATH |
---|
22 | export LD_LIBRARY_PATH |
---|
23 | export ATHENA_LOGIN_SESSION=$$ |
---|
24 | defaultboot=linux |
---|
25 | forcentfsresize="" |
---|
26 | lilotimeout=100 |
---|
27 | grubtimeout=$((${lilotimeout} / 10)) |
---|
28 | bootoptions=linux |
---|
29 | fstype=ext2 |
---|
30 | disk_setup=public |
---|
31 | create_hibernation_partition=false |
---|
32 | rc_public=false |
---|
33 | rc_autoupdate=true |
---|
34 | retain_tty_logins=false |
---|
35 | lba32=false |
---|
36 | extraliloopts="" |
---|
37 | finalshell=false |
---|
38 | convert_sata=auto |
---|
39 | bootloadertarget="" |
---|
40 | smp=false |
---|
41 | dhcp=false |
---|
42 | disk=none |
---|
43 | diskset="" |
---|
44 | hostname="" |
---|
45 | # Default filesystem sizes, in MB: |
---|
46 | bootsize=30 |
---|
47 | # Swapsize is determined dynamically; see below. |
---|
48 | cachesize=512 |
---|
49 | mincachesize=128 |
---|
50 | rootsize=4000 |
---|
51 | minrootsize=3400 |
---|
52 | moduleconf="" |
---|
53 | xdriver="" |
---|
54 | |
---|
55 | athenaversion=`tail -1 $CONTROL | awk '{ print $1 }'` |
---|
56 | athrel="${athenaversion%.*}" |
---|
57 | passwd=${SYSTEM}/config/${athenaversion}/etc |
---|
58 | |
---|
59 | # Introduce ourselves. |
---|
60 | echo "Installing Linux Athena ${athenaversion}." |
---|
61 | echo "Install source: ${SYSTEM}/${CONTROL}." |
---|
62 | echo "Install started at `date`." |
---|
63 | |
---|
64 | # Set various other variables based on the Athena version. |
---|
65 | case ${athrel} in |
---|
66 | 9.4) |
---|
67 | rpmopts="--nodeps" |
---|
68 | displayconf=system-config-display |
---|
69 | xconf=/etc/X11/xorg.conf |
---|
70 | moduleconf=/etc/modprobe.conf |
---|
71 | ;; |
---|
72 | *) |
---|
73 | rpmopts="" |
---|
74 | displayconf=redhat-config-xfree86 |
---|
75 | xconf=/etc/X11/XF86Config |
---|
76 | moduleconf=/etc/modules.conf |
---|
77 | ;; |
---|
78 | esac |
---|
79 | |
---|
80 | # Create the mount point for the install target filesystems. |
---|
81 | mkdir ${root} 2> /dev/null |
---|
82 | |
---|
83 | ### Mount filesystems in preparation for the install. |
---|
84 | mkdir -p ${root} |
---|
85 | mkdir ${root}/boot |
---|
86 | mkdir -p ${root}/usr/vice/cache |
---|
87 | mkdir ${root}/proc |
---|
88 | mount -t proc proc ${root}/proc |
---|
89 | mkdir ${root}/etc |
---|
90 | mkdir -p ${root}/var/athena |
---|
91 | |
---|
92 | |
---|
93 | #### Fetch some important files out of the installer and install them |
---|
94 | #### in the miniroot. |
---|
95 | if test -f /usr/ATHINSTALL ; then |
---|
96 | # Extract the install miniroot's version number. |
---|
97 | instversion=`cat /usr/ATHINSTALL` |
---|
98 | echo "[Installer miniroot version ${instversion}.]" |
---|
99 | # Put the rpm library stuff where rpm can find it; in the (static) /lib |
---|
100 | # in the miniroot; /usr/lib/rpm points to /usrlibrpm, which we can |
---|
101 | # actually create. |
---|
102 | ln -sf ${instroot}/usr/lib/rpm /usrlibrpm |
---|
103 | else |
---|
104 | # Assume we're running the old etherboot-based installer; |
---|
105 | # create symlinks for some required libraries (not on the corresponding |
---|
106 | # miniroot) which are needed for various install tools. |
---|
107 | # We don't warn the users here, because now it's done above. |
---|
108 | ln -sf ${instroot}/bin/bash /bin/bash |
---|
109 | ln -sf ${instroot}/lib/libtermcap.so.2.0.8 /usr/lib/libtermcap.so.2 |
---|
110 | ln -sf ${instroot}/lib/libext2fs.so.2.4 /lib/libext2fs.so.2 |
---|
111 | ln -sf ${instroot}/lib/libcom_err.so.2.0 /lib/libcom_err.so.2 |
---|
112 | ln -sf ${instroot}/lib/libuuid.so.1.2 /lib/libuuid.so.1 |
---|
113 | ln -sf ${instroot}/lib/libnss* /lib |
---|
114 | ln -sf ${instroot}/lib/libm.so.6 /lib/libm.so.6 |
---|
115 | ln -sf ${instroot}/lib/libpthread.so.0 /lib/libpthread.so.0 |
---|
116 | ln -sf ${instroot}/lib/ld-linux.so.2 /lib/ld-linux.so.2 |
---|
117 | ln -sf ${instroot}/lib/libe2p.so.2 /lib/libe2p.so.2 |
---|
118 | ln -sf ${instroot}/lib/libdl.so.2 /lib/libdl.so.2 |
---|
119 | ln -sf ${instroot}/usr/lib/rpm /usr/lib/rpm |
---|
120 | fi |
---|
121 | |
---|
122 | # The rest we need regardless. |
---|
123 | cp ${instroot}/etc/passwd /etc/passwd |
---|
124 | cp ${instroot}/etc/group /etc/group |
---|
125 | cp ${installer}/nsswitch.conf /etc/nsswitch.conf |
---|
126 | |
---|
127 | |
---|
128 | RPMLIST=`tail -1 $CONTROL | awk '{ print $2 }'` |
---|
129 | cp $RPMLIST ${root}/var/athena/release-rpms |
---|
130 | awk '{print $1}' $RPMLIST > ${root}/var/athena/install-rpms |
---|
131 | |
---|
132 | ### Other Athena setup. |
---|
133 | mkdir -p ${root}/usr/athena/info |
---|
134 | mkdir -p ${root}/var/lib/rpm |
---|
135 | |
---|
136 | |
---|
137 | #### The following account for missing dependencies in some packages |
---|
138 | #### post-install scripts. |
---|
139 | #### These will just get stomped on when the real RPMS install. |
---|
140 | |
---|
141 | mkdir -p ${root}/bin |
---|
142 | mkdir -p ${root}/sbin |
---|
143 | mkdir -p ${root}/usr/bin |
---|
144 | cp ${instroot}/bin/cat ${root}/bin/cat |
---|
145 | cp ${instroot}/bin/date ${root}/bin/date |
---|
146 | cp ${instroot}/bin/rm ${root}/bin/rm |
---|
147 | cp ${instroot}/bin/ln ${root}/bin/ln |
---|
148 | cp ${instroot}/bin/sed ${root}/bin/sed |
---|
149 | cp ${instroot}/bin/cp ${root}/bin/cp |
---|
150 | cp ${instroot}/bin/mv ${root}/bin/mv |
---|
151 | cp ${instroot}/bin/grep ${root}/bin/grep |
---|
152 | cp ${instroot}/bin/egrep ${root}/bin/egrep |
---|
153 | cp ${instroot}/bin/mkdir ${root}/bin/mkdir |
---|
154 | cp ${instroot}/usr/bin/env ${root}/usr/bin/env |
---|
155 | cp ${instroot}/usr/bin/wc ${root}/usr/bin/wc |
---|
156 | cp ${instroot}/usr/bin/find ${root}/usr/bin/find |
---|
157 | cp ${instroot}/sbin/install-info ${root}/sbin/install-info |
---|
158 | cp ${instroot}/sbin/pidof ${root}/sbin/pidof |
---|
159 | # This next bit is a temporary hack until 9.4.25 is out and |
---|
160 | # includes the relevant dependency. |
---|
161 | # mkdir -p ${root}/usr/sbin |
---|
162 | # cp /afs/dev/user/amb/tmp/groupadd ${root}/usr/sbin/groupadd |
---|
163 | |
---|
164 | #### |
---|
165 | #### Check the processor type, and downgrade the rpm list appropriately |
---|
166 | #### if necessary. |
---|
167 | RPMLIST=`tail -1 $CONTROL | awk '{ print $2 }'` |
---|
168 | cp $RPMLIST ${root}/var/athena/release-rpms |
---|
169 | awk '{print $1}' $RPMLIST > ${root}/var/athena/install-rpms |
---|
170 | cpufamily=`grep -i '^cpu family' < /proc/cpuinfo | head -1 | \ |
---|
171 | sed 's/^.*:[ ]*//'` |
---|
172 | case "$cpufamily" in |
---|
173 | 3|386*) |
---|
174 | echo "Downgrading RPM list to i386 and below." |
---|
175 | validcputypes="i386" |
---|
176 | ;; |
---|
177 | 4|486*) |
---|
178 | echo "Downgrading RPM list to i486 and below." |
---|
179 | validcputypes="i486 i386" |
---|
180 | ;; |
---|
181 | 5|586*) |
---|
182 | echo "Downgrading RPM list to i586 and below." |
---|
183 | validcputypes="i586 i486 i386" |
---|
184 | ;; |
---|
185 | esac |
---|
186 | |
---|
187 | if [ "$validcputypes" ] ; then |
---|
188 | rm -f ${root}/var/athena/install-rpms.new |
---|
189 | touch ${root}/var/athena/install-rpms.new |
---|
190 | for rpm in `cat ${root}/var/athena/install-rpms` ; do |
---|
191 | for arch in ${validcputypes} ; do |
---|
192 | crpm=`echo $rpm|sed -e 's/.i[3456]86.rpm$/.'${arch}'.rpm/'` |
---|
193 | if [ -f "${crpm}" ] ; then |
---|
194 | echo ${crpm} >> ${root}/var/athena/install-rpms.new |
---|
195 | break |
---|
196 | fi |
---|
197 | done |
---|
198 | done |
---|
199 | mv -f ${root}/var/athena/install-rpms.new ${root}/var/athena/install-rpms |
---|
200 | fi |
---|
201 | |
---|
202 | |
---|
203 | #### |
---|
204 | #### Set up RPM and install the package list. |
---|
205 | |
---|
206 | # Some scripts depend on /dev/null (and maybe other things) so make |
---|
207 | # sure they exist even before the dev package is installed. |
---|
208 | mkdir ${root}/dev |
---|
209 | ${instroot}/dev/MAKEDEV -c ${instroot}/etc/makedev.d -d ${root}/dev \ |
---|
210 | std cdrom hd sd |
---|
211 | |
---|
212 | echo "Installing rpms..." |
---|
213 | # rpm --root ${root} --initdb |
---|
214 | if ! rpm --root ${root} -Uvh ${rpmopts} \ |
---|
215 | `cat ${root}/var/athena/install-rpms` ; then |
---|
216 | echo "The installation of the Linux Athena rpms has produced an error." |
---|
217 | echo "This is probably due to insuffient space or other filesystem" |
---|
218 | echo "errors, but may be due to harmless problems, especially if this" |
---|
219 | echo "was an Athena 9.4 install." |
---|
220 | if [ "${athrel}" != 9.4 ] ; then |
---|
221 | echo ; echo "Press return to try continuing the install anyway." |
---|
222 | read response |
---|
223 | fi |
---|
224 | fi |
---|
225 | if [ "${smp}" = true ] ; then |
---|
226 | echo "Installing SMP kernel..." |
---|
227 | smpkernel=`grep kernel-[0-9] ${root}/var/athena/install-rpms| \ |
---|
228 | sed -e 's/kernel-/kernel-smp-/'` |
---|
229 | if ! rpm --root ${root} -Uvh ${smpkernel} ${rpmopts}; then |
---|
230 | echo "SMP kernel install failed." |
---|
231 | smp=false |
---|
232 | fi |
---|
233 | fi |
---|
234 | |
---|
235 | # Initialize passwd and shadow files |
---|
236 | cp ${passwd}/passwd ${root}/etc/passwd.local |
---|
237 | cp ${root}/etc/passwd.local ${root}/etc/passwd |
---|
238 | cp ${passwd}/shadow ${root}/etc/shadow.local |
---|
239 | cp ${root}/etc/shadow.local ${root}/etc/shadow |
---|
240 | cp ${passwd}/group ${root}/etc/group.local |
---|
241 | cp ${root}/etc/group.local ${root}/etc/group |
---|
242 | chmod 644 ${root}/etc/passwd.local ${root}/etc/passwd |
---|
243 | chmod 600 ${root}/etc/shadow.local ${root}/etc/shadow |
---|
244 | chmod 644 ${root}/etc/group.local ${root}/etc/group |
---|
245 | |
---|
246 | # Obtain and check hostname; prompt if necessary. |
---|
247 | if [ "${dhcp}" = false ] ; then |
---|
248 | hostname=`chroot ${root} /usr/athena/bin/host $IPADDR | \ |
---|
249 | sed 's#^.*domain name pointer \(.*\)$#\1#' | sed 's;\.*$;;' | \ |
---|
250 | tr '[A-Z]' '[a-z]'` |
---|
251 | if echo $hostname|grep -q "not found" ; then |
---|
252 | hostname="" |
---|
253 | printf "\a"; sleep 1 ; printf "\a"; sleep 1 ;printf "\a" |
---|
254 | echo "The IP address you selected, $IPADDR, does not have an associated" |
---|
255 | echo "hostname. Please confirm that you're using the correct address." |
---|
256 | while [ -z "$hostname" ] ; do |
---|
257 | echo -n "Enter hostname [no default]: " |
---|
258 | read hostname |
---|
259 | done |
---|
260 | fi |
---|
261 | fi |
---|
262 | |
---|
263 | cat > ${root}/etc/sysconfig/network <<EOF |
---|
264 | NETWORKING=yes |
---|
265 | FORWARD_IPV4=false |
---|
266 | HOSTNAME=$hostname |
---|
267 | EOF |
---|
268 | |
---|
269 | if [ "${dhcp}" = false ] ; then |
---|
270 | echo "GATEWAY=$GATEWAY" >> ${root}/etc/sysconfig/network |
---|
271 | fi |
---|
272 | |
---|
273 | cat > ${root}/etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF |
---|
274 | DEVICE=eth0 |
---|
275 | IPADDR=$IPADDR |
---|
276 | NETMASK=$NETMASK |
---|
277 | ONBOOT=yes |
---|
278 | EOF |
---|
279 | if [ "${dhcp}" = false ] ; then |
---|
280 | echo "BOOTPROTO=static" >> ${root}/etc/sysconfig/network-scripts/ifcfg-eth0 |
---|
281 | else |
---|
282 | echo "BOOTPROTO=dhcp" >> ${root}/etc/sysconfig/network-scripts/ifcfg-eth0 |
---|
283 | fi |
---|
284 | |
---|
285 | echo -n "Athena Workstation (linux) Version " > ${root}/etc/athena/version |
---|
286 | echo -n "$athenaversion " >> ${root}/etc/athena/version |
---|
287 | date >> ${root}/etc/athena/version |
---|
288 | |
---|
289 | MACHINE=`uname -m` |
---|
290 | OS=`uname -s` |
---|
291 | |
---|
292 | # Update various settings in /etc/athena/rc.conf. |
---|
293 | sed -e "s/localhost.localdomain/${hostname}/" \ |
---|
294 | -e "s/PUBLIC=false/PUBLIC=${rc_public}/" \ |
---|
295 | -e "s/ADDR=[\.0-9]*/ADDR=${IPADDR}/" \ |
---|
296 | -e "s/AUTOUPDATE=true/AUTOUPDATE=${rc_autoupdate}/" \ |
---|
297 | ${root}/etc/athena/rc.conf > /tmp/rc.conf |
---|
298 | mv /tmp/rc.conf ${root}/etc/athena/rc.conf |
---|
299 | |
---|
300 | # Copy AFS config files from AFS, since we don't know if the ones we got |
---|
301 | # from the AFS RPM are the most up to date ones available. |
---|
302 | for file in CellAlias CellServDB SuidCells; do |
---|
303 | cp /afs/athena.mit.edu/service/${file} ${root}/usr/vice/etc/${file} |
---|
304 | chown root:root ${root}/usr/vice/etc/${file} |
---|
305 | chmod a+r ${root}/usr/vice/etc/${file} |
---|
306 | done |
---|
307 | |
---|
308 | echo "Install finished at `date`." |
---|