1 # $NetBSD: rc.hack,v 1.4 1997/04/18 18:05:26 cgd Exp $
3 # Hackish /etc/rc to do basic setup for a distribution rz25 image to
4 # make it slightly easier to use.
6 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/alphadist
11 echo "Returning to single-user mode..."
15 root_dev=`(sysctl -n machdep.root_device) 2> /dev/null`
16 #echo "root_dev is '$root_dev'"
18 if [ X"${root_dev}" = X'' ] || [ X"${root_dev}" = X'??' ]; then
19 echo "Can't figure out root device!"
23 root_dev_base=`expr $root_dev : '\([a-z][a-z]*\)[0-9]*[a-z]'`
24 root_dev_unit=`expr $root_dev : '[a-z][a-z]*\([0-9]*\)[a-z]'`
25 root_dev_part=`expr $root_dev : '[a-z][a-z]*[0-9]*\([a-z]\)'`
31 usr_dev="${root_dev_base}${root_dev_unit}d"
32 #echo usr_dev = $usr_dev
34 case $root_dev_base in
39 echo "Unexpected root device type '$root_dev_base'."
44 # If /tmp is already writable, we've already been run... punt!
47 case $root_dev_base in
49 echo "Can't boot multi-user from a CD-ROM, because"
50 echo "the system can't have been configured."
52 echo "Install on a real disk!"
58 echo "If you want to boot multi-user, make sure that you've"
59 echo "configured the system properly, then run the"
62 echo " /bin/rm -f /etc/rc"
63 echo " /bin/cp -p /alphadist/rc.real /etc/rc"
65 echo "from single-user mode then exit the single-user shell."
72 case $root_dev_base in
74 echo -n "Remounting root device..."
75 mount -u -o ro /dev/$root_dev /
78 echo -n "Mounting /usr..."
79 mount -o ro /dev/$usr_dev /usr
82 echo -n "Preparing temporary file systems..."
83 mount -t mfs -o -s=6144 swap /tmp
84 mount -t mfs -o -s=6144 swap /var/tmp
85 mkdir /var/tmp/vi.recover
86 chmod -R 1777 /tmp /var/tmp
91 echo "Checking root and /usr..."
92 fsck -n -t ffs /dev/r$root_dev /dev/r$usr_dev > /dev/null 2>&1
94 echo "File system check failed!"
98 echo -n "Remounting root device..."
99 mount -u /dev/$root_dev /
102 echo -n "Mounting /usr..."
103 mount /dev/$usr_dev /usr