#!/bin/sh # # Created by William Astle, December 2002 # # This script is hereby placed in the public domain with no warrantee at all. # # this is the system initialization script # it ensures that things like the system clock # have been set up # # this was inspired by a script with similar function in the Slackware # Linux distribution PATH=/sbin:/usr/sbin:/bin:/usr/bin # enable swap space /sbin/swapon -a # do we have a readonly file system? READWRITE=no if echo -n >> "Testing filesystem status"; then rm -f "Testing filesystem status" READWRITE=yes fi # we only check the root file system if it is mounted read-only if [ ! $READWRITE = yes ]; then /sbin/fsck -A -a # if we failed, go single user if [ $? -gt 1 ]; then echo "An error occurred during file system check. Please fix manually." PS1="(Repair filesystem \#"; export PS1 sulogin umount -a mount -n -o remount,ro / echo "Rebooting system..." sleep 2 reboot fi echo "Remounting root device read-write" /bin/mount -w -v -n -o remount / if [ $? -gt 0 ]; then echo -n "Remount failed! Please look into it and reboot. Press enter to continue" read junk fi else echo "*** ERROR: Root partition is already read-write. Not checking!" echo -n "Press enter to continue. " read junk fi # clean up some files /bin/rm -f /etc/mtab* /etc/nologin /etc/shutdownpid # mount local filesystems and make an entry for / echo "Mounting local file systems" /bin/mount -a -v -t nonfs # now that we have /proc, set to reboot on panics # I find this useful for system that are in remote locations echo 30 > /proc/sys/kernel/panic # clean up /var /bin/rm -f /var/run/*.pid /var/run/rcstate/* # set system clock # NOTE: this assumes UTC for the system clock echo "Setting system time..." /sbin/hwclock -s -u # set the hostname here - it's basically immutable # replace this with the appropriate stuff for you /bin/hostname fred /bin/domainname barney.foo # add anything else you feel is needed here