3 # hdw - linux /etc/init.d/boot (copied from ROCK Linux + modifications)
5 # lowlevel bootup script
10 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
12 echo "** booting hdw-linux... **"
15 [ -f /fastboot ] && FASTBOOT=1 ; [ -f /forcefsck ] && FORCEFSCK=1
16 if [ $FORCEFSCK = 1 ] ; then echo "going to force fsck" ; FASTBOOT=0 ; fi
17 [ $FASTBOOT = 1 ] && echo "fast boot mode enabled"
20 mount -v -n /proc ; mount -v -n /sys
22 echo "loading kernel modules and configuring the kernel ..."
25 echo "populating device nodes ..."
26 /etc/init.d/udev start
28 if [ -f /etc/conf/devfs ] ; then
29 echo "configuring device nodes ..."
33 echo "activating swap-devices ..."
38 echo "checking file systems (1/3) ..."
39 mount -n -o remount,ro /
41 then fsck -A -C -a -f ; fsckrc=$? ; sync ; sleep 3
42 else fsck -A -C -a ; fsckrc=$? ; sync ; sleep 3
45 [ $fsckrc -eq 1 -a $EASYFSCK = 1 ] && fsckrc=0
46 while [ $fsckrc -eq 1 -a $x -lt 4 ]
48 echo "filesystem check modified disks!"
49 echo "checking file systems ($x/3) ..."
50 fsck -A -C -a -f ; fsckrc=$? ; sync ; sleep 3
51 if [ $x -eq 3 ] ; then x=4 ; else x=3 ; fi
55 echo "all checked filesystems are clear."
58 echo " ** filesystem check modified disks."
60 echo " ** going to reboot the system."
62 for x in 10 9 8 7 6 5 4 3 2 ; do
63 echo -en "\rsystem reboot in $x seconds ... "
65 done ; echo -e "\rsystem reboot now! "
71 echo " ** filesystem check failed (returncode=$fsckrc)."
72 echo " ** please repair the broken disk(s) manually."
74 echo " ** note: The kernel parameter '-b' can be used to boot"
75 echo " ** directly into a single-user login shell."
77 echo " ** going to reboot the system."
79 for x in 10 9 8 7 6 5 4 3 2 ; do
80 echo -en "\rsystem reboot in $x seconds ... "
82 done ; echo -e "\rsystem reboot now! "
88 mount -v -n -o remount,rw /
89 grep -E -v '^none (/|[a-z]+:) ' /proc/mounts > /etc/mtab
90 mount -v -a -t nocoda,nfs
92 if type hostname > /dev/null 2>&1
94 echo "set the hostname to [`cat /etc/HOSTNAME`] ..."
95 hostname `cat /etc/HOSTNAME`
97 echo "hostname not set: no 'hostname' command found"
100 echo "refresh utmp, delete lock files and other stuff ..."
101 rm -f /var/lock/* /var/lock/*/* /var/run/* 2> /dev/null
102 touch /var/run/utmp ; chmod 664 /var/run/utmp ; chown root.tty /var/run/utmp
103 rm -f /etc/nologin /nologin /fastboot /forcefsck /fastdown
105 if [ "$TEMPCLEAN" = 1 ] ; then
106 echo "cleaning up /tmp ..."
107 for x in /tmp/* /tmp/.[!.]* ; do
108 if [ -O "$x" ] ; then
109 [ "$x" != "/tmp/lost+found" ] &&
110 [ "$x" != "/tmp/quota.user" ] &&
111 [ "$x" != "/tmp/quota.group" ] &&
119 if type klogd > /dev/null 2>&1
121 echo "writing /var/log/boot.msg ..."
122 klogd -f /var/log/boot.new -o
123 grep '.' < /var/log/boot.new > /var/log/boot.msg
126 echo "kernel boot messages are not logged: no 'klogd' command found."
129 if type loadkeys > /dev/null 2>&1
131 echo "set the keyboard keymappings ..."
132 if [ -L /etc/default.keymap ] ; then
133 oldpwd="`pwd`" ; cd /etc
134 loadkeys `ls -l default.keymap | tr -s ' ' | cut -f11 -d' '`
135 cd "$oldpwd" ; unset oldpwd
136 elif [ -f /etc/default.keymap ] ; then
137 loadkeys /etc/default.keymap
139 echo "no /etc/default.keymap found."
142 echo "keymappings not configured: no 'loadkeys' command found."
145 if type ifconfig > /dev/null 2>&1
147 echo "setting up loopback networking ..."
148 ifconfig lo 127.0.0.1 netmask 255.0.0.0 up
149 route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
152 echo 'setting overflow UID and GID kernel parameters ...'
153 sysctl -w kernel.overflowuid=`id -u nobody` | tr -d '\n'
154 echo -n ', ' ; sysctl -w kernel.overflowgid=`id -g nobody`
156 echo "initializing kernel random number generator ..."
157 [ -f /var/state/random-seed ] && cat /var/state/random-seed >/dev/urandom
158 dd if=/dev/urandom of=/var/state/random-seed count=1 2> /dev/null
160 # write EOT mark for btee