source: trunk/debathena/config/athena-chroot/installer/phase2.backend.debathena @ 22901

Revision 22901, 9.7 KB checked in by tabbott, 17 years ago (diff)
Initial checkin of Athena 9.4 chroot packages. Note that these packages require you to backport schroot 1.1.6
  • Property svn:executable set to *
Line 
1#!/installer/root/bin/sh
2
3echo "[Starting phase 2 installer.]"
4cd $SYSTEM
5
6# clear up some space in /
7rm -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.
14export TZ=US/Eastern
15umask 022
16installer=$SYSTEM/installer
17instroot=${installer}/root
18root=/sysimage
19PATH=${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
20LD_LIBRARY_PATH=${instroot}/lib:${instroot}/usr/lib:/lib:/usr/lib:/usr/X11R6/lib:
21export PATH
22export LD_LIBRARY_PATH
23export ATHENA_LOGIN_SESSION=$$
24defaultboot=linux
25forcentfsresize=""
26lilotimeout=100
27grubtimeout=$((${lilotimeout} / 10))
28bootoptions=linux
29fstype=ext2
30disk_setup=public
31create_hibernation_partition=false
32rc_public=false
33rc_autoupdate=true
34retain_tty_logins=false
35lba32=false
36extraliloopts=""
37finalshell=false
38convert_sata=auto
39bootloadertarget=""
40smp=false
41dhcp=false
42disk=none
43diskset=""
44hostname=""
45# Default filesystem sizes, in MB:
46bootsize=30
47# Swapsize is determined dynamically; see below.
48cachesize=512
49mincachesize=128
50rootsize=4000
51minrootsize=3400
52moduleconf=""
53xdriver=""
54
55athenaversion=`tail -1 $CONTROL | awk '{ print $1 }'`
56athrel="${athenaversion%.*}"
57passwd=${SYSTEM}/config/${athenaversion}/etc
58
59# Introduce ourselves.
60echo "Installing Linux Athena ${athenaversion}."
61echo "Install source: ${SYSTEM}/${CONTROL}."
62echo "Install started at `date`."
63
64# Set various other variables based on the Athena version.
65case ${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    ;;
78esac
79
80# Create the mount point for the install target filesystems.
81mkdir ${root} 2> /dev/null
82
83### Mount filesystems in preparation for the install.
84mkdir -p ${root}
85mkdir ${root}/boot
86mkdir -p ${root}/usr/vice/cache
87mkdir ${root}/proc
88mount -t proc proc ${root}/proc
89mkdir ${root}/etc
90mkdir -p ${root}/var/athena
91
92
93#### Fetch some important files out of the installer and install them
94#### in the miniroot.
95if 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
103else
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
120fi
121
122# The rest we need regardless.
123cp ${instroot}/etc/passwd /etc/passwd
124cp ${instroot}/etc/group /etc/group
125cp ${installer}/nsswitch.conf /etc/nsswitch.conf
126
127
128RPMLIST=`tail -1 $CONTROL | awk '{ print $2 }'`
129cp $RPMLIST ${root}/var/athena/release-rpms
130awk '{print $1}' $RPMLIST > ${root}/var/athena/install-rpms
131
132### Other Athena setup.
133mkdir -p ${root}/usr/athena/info
134mkdir -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
141mkdir -p ${root}/bin
142mkdir -p ${root}/sbin
143mkdir -p ${root}/usr/bin
144cp ${instroot}/bin/cat ${root}/bin/cat
145cp ${instroot}/bin/date ${root}/bin/date
146cp ${instroot}/bin/rm ${root}/bin/rm
147cp ${instroot}/bin/ln ${root}/bin/ln
148cp ${instroot}/bin/sed ${root}/bin/sed
149cp ${instroot}/bin/cp ${root}/bin/cp
150cp ${instroot}/bin/mv ${root}/bin/mv
151cp ${instroot}/bin/grep ${root}/bin/grep
152cp ${instroot}/bin/egrep ${root}/bin/egrep
153cp ${instroot}/bin/mkdir ${root}/bin/mkdir
154cp ${instroot}/usr/bin/env ${root}/usr/bin/env
155cp ${instroot}/usr/bin/wc ${root}/usr/bin/wc
156cp ${instroot}/usr/bin/find ${root}/usr/bin/find
157cp ${instroot}/sbin/install-info ${root}/sbin/install-info
158cp ${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.
167RPMLIST=`tail -1 $CONTROL | awk '{ print $2 }'`
168cp $RPMLIST ${root}/var/athena/release-rpms
169awk '{print $1}' $RPMLIST > ${root}/var/athena/install-rpms
170cpufamily=`grep -i '^cpu family' < /proc/cpuinfo | head -1 | \
171    sed 's/^.*:[        ]*//'`
172case "$cpufamily" in
1733|386*)
174  echo "Downgrading RPM list to i386 and below."
175  validcputypes="i386"
176  ;;
1774|486*)
178  echo "Downgrading RPM list to i486 and below."
179  validcputypes="i486 i386"
180  ;;
1815|586*)
182  echo "Downgrading RPM list to i586 and below."
183  validcputypes="i586 i486 i386"
184  ;;
185esac
186
187if [ "$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
200fi
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.
208mkdir ${root}/dev
209${instroot}/dev/MAKEDEV -c ${instroot}/etc/makedev.d -d ${root}/dev \
210    std cdrom hd sd
211
212echo "Installing rpms..."
213# rpm --root ${root} --initdb
214if ! 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
224fi
225if [ "${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
233fi
234
235# Initialize passwd and shadow files
236cp ${passwd}/passwd ${root}/etc/passwd.local
237cp ${root}/etc/passwd.local ${root}/etc/passwd
238cp ${passwd}/shadow ${root}/etc/shadow.local
239cp ${root}/etc/shadow.local ${root}/etc/shadow
240cp ${passwd}/group ${root}/etc/group.local
241cp ${root}/etc/group.local ${root}/etc/group
242chmod 644 ${root}/etc/passwd.local ${root}/etc/passwd
243chmod 600 ${root}/etc/shadow.local ${root}/etc/shadow
244chmod 644 ${root}/etc/group.local ${root}/etc/group
245
246# Obtain and check hostname; prompt if necessary.
247if [ "${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
261fi
262
263cat > ${root}/etc/sysconfig/network <<EOF
264NETWORKING=yes
265FORWARD_IPV4=false
266HOSTNAME=$hostname
267EOF
268
269if [ "${dhcp}" = false ] ; then
270  echo "GATEWAY=$GATEWAY" >> ${root}/etc/sysconfig/network
271fi
272
273cat > ${root}/etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
274DEVICE=eth0
275IPADDR=$IPADDR
276NETMASK=$NETMASK
277ONBOOT=yes
278EOF
279if [ "${dhcp}" = false ] ; then
280  echo "BOOTPROTO=static" >> ${root}/etc/sysconfig/network-scripts/ifcfg-eth0
281else
282  echo "BOOTPROTO=dhcp" >> ${root}/etc/sysconfig/network-scripts/ifcfg-eth0
283fi
284
285echo -n "Athena Workstation (linux) Version " > ${root}/etc/athena/version
286echo -n "$athenaversion " >> ${root}/etc/athena/version
287date >> ${root}/etc/athena/version
288
289MACHINE=`uname -m`
290OS=`uname -s`
291
292# Update various settings in /etc/athena/rc.conf.
293sed -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
298mv /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.
302for 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}
306done
307
308echo "Install finished at `date`."
Note: See TracBrowser for help on using the repository browser.