#!/bin/sh
stty intr undef
stty kill undef
stty quit undef
stty susp undef
stty start undef
stty stop undef
stty dsusp undef
. /etc/rc.common
PATH=/bin:/sbin
BootType=${1-Multiuser}
hostname localhost
if [ -d /System/Installation ] && [ -f /private/etc/rc.cdrom ]; then
ConsoleMessage "Root device is mounted read-only"
ConsoleMessage "Filesystem checks skipped"
iscdrom=1
else
iscdrom=0
fi
date
fsckerror=0
if [ ${iscdrom} -ne 1 ]; then
if [ "${BootType}" = "singleuser" ]; then
ConsoleMessage "Singleuser boot -- fsck not done"
ConsoleMessage "Root device is mounted read-only"
ConsoleMessage "If you want to make modifications to files,"
ConsoleMessage "run '/sbin/fsck -y' first and then '/sbin/mount -uw /' "
else
ConsoleMessage "Checking disk"
fsck -p
case $? in
0)
;;
2)
ConsoleMessage "Request to remain single-user received"
fsckerror=1
;;
4)
ConsoleMessage "Root filesystem fixed - rebooting"
reboot -q -n
;;
8)
ConsoleMessage "Reboot failed - serious errors"
fsckerror=1
;;
12)
ConsoleMessage "Reboot interrupted"
fsckerror=1
;;
*)
ConsoleMessage "Unknown error while checking disks"
fsckerror=1
;;
esac
fi
fi
sync
if [ "${BootType}" = "singleuser" ] && [ ${iscdrom} -eq 1 ]; then
echo ""
echo "You are now in single-user mode while booted from a CD-ROM."
echo "Since the root disk is read-only, some commands may not work as"
echo "they normally do. In particular, commands that try to create"
echo "files in /tmp will probably fail. One way to avoid this problem"
echo "is to mount a separate hard disk or floppy on /tmp using the"
echo "mount command. For example,'/sbin/mount /dev/fd0a /tmp' puts"
echo "/tmp on the internal floppy disk."
echo ""
fi
if [ ${fsckerror} -ne 0 ]; then
fsck -y && reboot
fi
exit 0