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

echo "running /etc/rc..."

PATH=/sbin:/bin:/usr/bin:/usr/sbin; export PATH

# fsck disks if system crashed

if [ -f /fastboot ]
then
    echo Skipping fcsk
else
    fsck -AV < /dev/console
    if [ $? -gt 0 ]; then
        echo "Warning: fsck FAILED"
        echo "         Starting single user shell"
        echo "         Fix filesystem and REBOOT"
        sh -si < /dev/console > /dev/console 2>&1
    fi
fi
mount -n -w -oremount /

# start the update(8) sync demon
/sbin/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
mount -av
mount -v /proc

# remove stale locks (must be done after mount -a!)
/bin/rm -f /var/spool/locks/* /var/spool/uucp/LCK*
rm -rf /tmp; mkdir /tmp; chmod 777 /tmp

# remove /var/adm/utmp and touch it
rm -f /var/adm/utmp
touch /var/adm/utmp

# enable swapping
swapon -a

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

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

exit 0
