Commit bb4adae3 authored by Mike Hibler's avatar Mike Hibler
Browse files

1. use slicefix whenever loaded disk is not "ad0"

2. teach slicefix how to customize linux partitions
   (/etc/fstab and /etc/lilo.conf)
3. lint in dhclient* files
parent 79f0d974
......@@ -7,5 +7,5 @@
ifconfig lo0 down
ifconfig lo0 inet 127.0.0.1
/sbin/dhclient $flags
/sbin/dhclient
exit $?
......@@ -39,6 +39,7 @@ fi
#
# I'd love to use the dhclient.pid file, but it helpfully has not been
# created at this point
#
killall dhclient >>$LOGDIR/dhclient.log 2>&1
#
......
......@@ -124,9 +124,9 @@ if [ x"$ADDRESS" != x ]; then
$BINDIR/growdisk -vW /dev/$DISK
#
# XXX limit the use of slicefix for now to just
# those machines with "ad4" as their root disk
# those machines with SATA/SCSI as their root disk
#
if [ -x $BINDIR/slicefix -a "$DISK" = "ad4" ]; then
if [ -x $BINDIR/slicefix -a "$DISK" != "ad0" ]; then
echo "Adjusting slice-related files";
$BINDIR/slicefix $PARTITION $DISK
fi
......
......@@ -9,6 +9,7 @@ if [ -r /etc/emulab/paths.sh ]; then
. /etc/emulab/paths.sh
else
BINDIR=/etc/testbed
BOOTDIR=/var/emulab/boot
fi
disk="ad0"
......@@ -57,8 +58,64 @@ dofreebsd() {
}
dolinux() {
# need to update fstab, lilo.conf
echo "do not do linux yet"
# figure out the linux device name
dunit=`echo $disk | sed -e 's/..\([0-7]\)/\1/'`
case $disk in
# IDE
ad[0-3])
dtype="hd"
d=`echo $dunit | sed -e 'y/0123/048c/'`
lrootdev="3${d}${part}"
;;
# SATA
ad[4-7])
dtype="sd"
dunit=`expr $dunit - 4`
lrootdev="8${dunit}${part}"
;;
# SCSI
da[0-7])
dtype="sd"
lrootdev="8${dunit}${part}"
;;
*)
echo "slicefix: linux: unknown disk $disk"
return 1
;;
esac
dunit=`echo $dunit | sed -e 'y/01234567/abcdefgh/'`;
ldisk=$dtype$dunit
# attempt to mount filesystem
rootdev=/dev/${disk}s${part}
mount -t ext2fs $rootdev /mnt || {
echo "EXT2FS mount of $rootdev failed"
return 1
}
# change the swap devices in fstab
sed -i .orig -e "s;^/dev/[hs]d.\([0-7]\);/dev/${ldisk}\1;" /mnt/etc/fstab || {
echo "Failed to update /etc/fstab"
umount $rootdev
return 1
}
# update lilo.conf and set indicator to tell Emulab to rerun lilo
sed -i .orig -e "s;\([br]oot=/dev\)/[hs]d.\([0-7]\);\1/${ldisk}\2;" /mnt/etc/lilo.conf || {
echo "Failed to update /etc/lilo.conf"
umount $rootdev
return 1
}
cp /dev/null /mnt/$BOOTDIR/runlilo
umount $rootdev
# setup one time lilo command line, must be done after unmount
$BINDIR/groklilo -c "linux root=$lrootdev" $part /dev/$disk || {
echo "Failed to set LILO command line"
return 1
}
return 0
}
......@@ -93,6 +150,11 @@ case $part in
part=3; fixone
part=4; fixone
# when fixing all partitions, do not fail on an error
if [ $? -ne 0 ]; then
echo "WARNING: failed to fix one or more partitions, BEWARE!"
fi
# for the CD boot, we need to intialize the magic boot block
if [ -e /cdrom.inf -a -x $BINDIR/tbbootconfig ]; then
$BINDIR/tbbootconfig -f -c 1 -k 0 -m 1 /dev/${disk}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment