066cc0d79c
>add a little hack, to replace /etc/rc on the distribution disk image, >to make life a little bit easier for people just starting out. >(remounts root read-write, mounts /usr, etc.) includes instructions >on how to get 'normal' /etc/rc as the default. does _not_ appear >in the tar files.
109 lines
2.2 KiB
Plaintext
109 lines
2.2 KiB
Plaintext
# $NetBSD: rc.hack,v 1.2 1996/06/15 04:04:28 cgd Exp $
|
|
|
|
# Hackish /etc/rc to do basic setup for a distribution rz25 image to
|
|
# make it slightly easier to use.
|
|
|
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/alphadist
|
|
export PATH
|
|
|
|
single_user()
|
|
{
|
|
echo "Returning to single-user mode..."
|
|
exit 1
|
|
}
|
|
|
|
root_dev=`(sysctl -n machdep.root_device) 2> /dev/null`
|
|
#echo "root_dev is '$root_dev'"
|
|
|
|
if [ X"${root_dev}" = X'' ] || [ X"${root_dev}" = X'??' ]; then
|
|
echo "Can't figure out root device!"
|
|
single_user
|
|
fi
|
|
|
|
root_dev_base=`expr $root_dev : '\([a-z][a-z]*\)[0-9]*[a-z]'`
|
|
root_dev_unit=`expr $root_dev : '[a-z][a-z]*\([0-9]*\)[a-z]'`
|
|
root_dev_part=`expr $root_dev : '[a-z][a-z]*[0-9]*\([a-z]\)'`
|
|
|
|
#echo $root_dev_base
|
|
#echo $root_dev_unit
|
|
#echo $root_dev_part
|
|
|
|
usr_dev="${root_dev_base}${root_dev_unit}d"
|
|
#echo usr_dev = $usr_dev
|
|
|
|
case $root_dev_base in
|
|
cd|sd)
|
|
;;
|
|
|
|
*)
|
|
echo "Unexpected root device type '$root_dev_base'."
|
|
single_user
|
|
;;
|
|
esac
|
|
|
|
# If /tmp is already writeable, we've already been run... punt!
|
|
if [ -w /tmp ]; then
|
|
echo ""
|
|
case $root_dev_base in
|
|
cd)
|
|
echo "Can't boot multi-user from a CD-ROM, because"
|
|
echo "the system can't have been configured."
|
|
echo ""
|
|
echo "Install on a real disk!"
|
|
echo ""
|
|
single_user
|
|
;;
|
|
|
|
sd)
|
|
echo "If you want to boot multi-user, make sure that you've"
|
|
echo "configured the system properly, then run the"
|
|
echo "following:"
|
|
echo ""
|
|
echo " /bin/rm -f /etc/rc"
|
|
echo " /bin/cp -p /alphadist/rc.real /etc/rc"
|
|
echo ""
|
|
echo "from single-user mode then exit the single-user shell."
|
|
echo ""
|
|
single_user
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
case $root_dev_base in
|
|
cd)
|
|
echo -n "Remounting root device..."
|
|
mount -u -o ro /dev/$root_dev /
|
|
echo ""
|
|
|
|
echo -n "Mounting /usr..."
|
|
mount -o ro /dev/$usr_dev /usr
|
|
echo ""
|
|
|
|
echo -n "Preparing temporary file systems..."
|
|
mount -t mfs -o -s=6144 swap /tmp
|
|
mount -t mfs -o -s=6144 swap /var/tmp
|
|
mkdir /var/tmp/vi.recover
|
|
chmod -R 1777 /tmp /var/tmp
|
|
echo ""
|
|
;;
|
|
|
|
sd)
|
|
echo "Checking root and /usr..."
|
|
fsck -n /dev/r$root_dev /dev/r$usr_dev > /dev/null 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
echo "File system check failed!"
|
|
single_user
|
|
fi
|
|
|
|
echo -n "Remounting root device..."
|
|
mount -u /dev/$root_dev /
|
|
echo ""
|
|
|
|
echo -n "Mounting /usr..."
|
|
mount /dev/$usr_dev /usr
|
|
echo ""
|
|
;;
|
|
esac
|
|
|
|
single_user
|