# /etc/rc
#
# These commands are executed at boot time by init(8).
# User customization should go in /etc/rc.local.

PATH=/bin:/usr/bin:/etc

# fsck disks if system crashed

if [ -f /fastboot ]
then
    echo Skipping fcsk
else
    /etc/fsck -AV -a
    # If there was a failure, drop into single-user mode.
    # NOTE: This is not secure.  If security is needed, make sure than
    #       /etc/securesinlge exists and "reboot single".  simipleinit
    #       will then prompt for root's password.
    if [ $? -gt 1 ]
    then
        echo "Warning: fsck FAILED"
        echo "         Starting single user shell"
        echo "         Fix filesystem and REBOOT"
        /bin/sh -si < /dev/console > /dev/console 2>&1
    fi
fi

# Remount the root filesystem in read-write mode
/etc/mount -n -o remount /dev/hda1 /

# start the update(8) sync demon
/etc/update &

# remove /etc/mtab* so that mount will create it with a root entry
/bin/rm -f /etc/nologin /fastboot /etc/mtab*

# mount file systems in fstab (and create an entry for /)
# but not NFS because TCP/IP is not yet configured
/etc/mount -avt nonfs

# remove stale locks (must be done after mount -a!)
/bin/rm -f /usr/spool/locks/* /usr/spool/uucp/LCK*

# remove /etc/utmp and touch it
rm -f /etc/utmp
touch /etc/utmp

# enable swapping
/etc/swapon -a

# start up cron if it exists
if [ -f /usr/etc/crond ]; then
	/usr/etc/crond
fi

# do any local stuff
/bin/sh /etc/rc.local

exit 0
