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
21 mkdir -p /dev/shm ; mount -v -n /dev/shm
22 mkdir -p /dev/pts ; mount -v -n /dev/pts
24 echo "loading kernel modules and configuring the kernel ..."
27 echo "populating device nodes ..."
28 /etc/init.d/udev start
30 if [ -f /etc/conf/devfs ] ; then
31 echo "configuring device nodes ..."
35 echo "activating swap-devices ..."
40 echo "checking file systems (1/3) ..."
41 mount -n -o remount,ro /
43 then fsck -A -C -a -f ; fsckrc=$? ; sync ; sleep 3
44 else fsck -A -C -a ; fsckrc=$? ; sync ; sleep 3
47 [ $fsckrc -eq 1 -a $EASYFSCK = 1 ] && fsckrc=0
48 while [ $fsckrc -eq 1 -a $x -lt 4 ]
50 echo "filesystem check modified disks!"
51 echo "checking file systems ($x/3) ..."
52 fsck -A -C -a -f ; fsckrc=$? ; sync ; sleep 3
53 if [ $x -eq 3 ] ; then x=4 ; else x=3 ; fi
57 echo "all checked filesystems are clear."
60 echo " ** filesystem check modified disks."
62 echo " ** going to reboot the system."
64 for x in 10 9 8 7 6 5 4 3 2 ; do
65 echo -en "\rsystem reboot in $x seconds ... "
67 done ; echo -e "\rsystem reboot now! "
73 echo " ** filesystem check failed (returncode=$fsckrc)."
74 echo " ** please repair the broken disk(s) manually."
76 echo " ** note: The kernel parameter '-b' can be used to boot"
77 echo " ** directly into a single-user login shell."
79 echo " ** going to reboot the system."
81 for x in 10 9 8 7 6 5 4 3 2 ; do
82 echo -en "\rsystem reboot in $x seconds ... "
84 done ; echo -e "\rsystem reboot now! "
90 mount -v -n -o remount,rw /
91 grep -E -v '^none (/|[a-z]+:) ' /proc/mounts > /etc/mtab
92 mount -v -a -t nocoda,nfs
94 if type hostname > /dev/null 2>&1
96 echo "set the hostname to [`cat /etc/HOSTNAME`] ..."
97 hostname `cat /etc/HOSTNAME`
99 echo "hostname not set: no 'hostname' command found"
102 echo "refresh utmp, delete lock files and other stuff ..."
103 rm -f /var/lock/* /var/lock/*/* /var/run/* 2> /dev/null
104 touch /var/run/utmp ; chmod 664 /var/run/utmp ; chown root.tty /var/run/utmp
105 rm -f /etc/nologin /nologin /fastboot /forcefsck /fastdown
107 if [ "$TEMPCLEAN" = 1 ] ; then
108 echo "cleaning up /tmp ..."
109 for x in /tmp/* /tmp/.[!.]* ; do
110 if [ -O "$x" ] ; then
111 [ "$x" != "/tmp/lost+found" ] &&
112 [ "$x" != "/tmp/quota.user" ] &&
113 [ "$x" != "/tmp/quota.group" ] &&
121 if type klogd > /dev/null 2>&1
123 echo "writing /var/log/boot.msg ..."
124 klogd -f /var/log/boot.new -o
125 grep '.' < /var/log/boot.new > /var/log/boot.msg
128 echo "kernel boot messages are not logged: no 'klogd' command found."
131 if type loadkeys > /dev/null 2>&1
133 echo "set the keyboard keymappings ..."
134 if [ -L /etc/default.keymap ] ; then
135 oldpwd="`pwd`" ; cd /etc
136 loadkeys `ls -l default.keymap | tr -s ' ' | cut -f11 -d' '`
137 cd "$oldpwd" ; unset oldpwd
138 elif [ -f /etc/default.keymap ] ; then
139 loadkeys /etc/default.keymap
141 echo "no /etc/default.keymap found."
144 echo "keymappings not configured: no 'loadkeys' command found."
147 if type ifconfig > /dev/null 2>&1
149 echo "setting up loopback networking ..."
150 ifconfig lo 127.0.0.1 netmask 255.0.0.0 up
151 route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
154 echo 'setting overflow UID and GID kernel parameters ...'
155 sysctl -w kernel.overflowuid=`id -u nobody` | tr -d '\n'
156 echo -n ', ' ; sysctl -w kernel.overflowgid=`id -g nobody`
158 echo "initializing kernel random number generator ..."
159 [ -f /var/state/random-seed ] && cat /var/state/random-seed >/dev/urandom
160 dd if=/dev/urandom of=/var/state/random-seed count=1 2> /dev/null
162 # write EOT mark for btee