#! /bin/sh
#
# bootscript -- the very first thing init should be doing; checking
# filesystems, setting the machine name, loading modules, cleaning
# out the trash.

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/etc/rc.d/functions; export PATH

# historical artifact city.
if [ ! -f /etc/fastboot ]; then
    echo "checking filesystems"
    fsck -A -av
    if [ $? -gt 1 ]; then
	echo "fsck FAILED -- correct by hand"
	sh
    fi
fi

# load system information
. /etc/rc.d/sysconfig

hostname $HOSTNAME
# hostname --fqdn

# Remount the root filesystem in read-write mode
mount -n -o remount,rw /

# Be sure /etc/mtab and /etc/utmp are up to date.
rm -f /etc/mtab* /etc/fastboot /etc/nologin /var/pid/syslog.pid
sync > /var/log/utmp; chmod 444 /var/log/utmp

# mount / (again, for mtab) and /proc
#
mount -o remount,rw /
mount /proc

# set the time from the hardware clock (which is hopefully is set to GMT)
#
clock -su

# don't log messages to the console unless syslog wants to do it.
#
stfu

# grab a copy of the system bootup messages, for running
# hardware inventories.
dmesg > /var/log/dmesg

# load various and sundry modules

depmod -a		# rebuild modules database
kerneld			# then start kerneld to automatically load most
			# every module except for networking cards, which
ether-modules		# we handload to avoid icky user editing of config
			# files.

# All done.
