1 # /etc/rc - System startup script run by init before going multiuser.
5 PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin
11 echo >&2 "Usage: $0 [-saf] start|stop|down"
20 # Function to dynamically start a system service
22 service up /sbin/$service "$@"
25 while getopts 'saf' opt
28 s) sflag=t ;; # Single user
29 a) aflag=t ;; # Ask for /usr
30 f) fflag=t ;; # Force a full file system check
34 shift `expr $OPTIND - 1`
37 1:start|1:stop|1:down)
46 echo -n "Multiuser startup in progress ...:"
49 test -f /etc/keymap && loadkeys /etc/keymap
60 # Try to read the hardware real-time clock, otherwise do it manually.
61 readclock || intr date -q
64 printroot >/etc/mtab # /etc/mtab keeps track of mounts
65 >/etc/utmp # /etc/utmp keeps track of logins
67 # /etc/fstab lists the root, tmp and usr devices.
70 # Any swapspace on a device?
71 test "$swap" : '/dev/' && mount -s $swap
73 # Are we booting from CD?
74 bootcd="`/bin/sysenv bootcd`"
76 # If booting from CD, /usr has to be mounted readonly.
77 # Also, $usr won't be specified correctly in the
78 # fstab (the CD could be anywhere), so we decide
79 # where it is based on sysenv (set by FS when probing for CD).
82 #imagedev="`/bin/sysenv cdproberoot`"
83 #usrdev="`expr $imagedev + 1`"
86 echo "Setting /usr on cd is $usr"
89 # Mount the /usr partition unless this is a single floppy Minix.
92 if [ "$aflag" -o "$usr" = unknown ]
94 # We need to ask what the /usr du jour is.
96 echo -n "Finish the name of device to mount as /usr: /dev/"
98 echo "usr=/dev/$usr" >/tmp/usr'
101 mount $usr_roflag $usr /usr || {
103 Please try to mount something else as /usr, then hit CTRL-D to continue startup.
104 Mount $usr /usr failed -- Single user."
110 # Check if the system crashed.
114 echo "The system was not properly shut down. Checking file systems."
121 echo "fsck / - $root"
123 echo "fsck /usr - $usr"
126 then echo "fsck /home - $home"
133 then mount $home /home || echo "WARNING: couldn't mount $home on /home"
136 # This file is necessary for above 'shutdown -C' check.
137 # (Silence stderr in case of running from cd.)
138 touch /usr/adm/wtmp 2>/dev/null
146 # Any swapspace on a file?
147 test -n "$swap" -a ! "$swap" : '/dev/' && mount -s $swap
150 case "`printroot -r`":$bootcd in
152 # Remove boot-only things to make space,
153 # unless booting from CD, in which case we need them.
155 # put the compiler on ram
156 cp /usr/lib/em* /usr/lib/cpp* /lib
159 # Things should be alright now.
164 echo -n 'Updating CMOS.. '
165 readclock -w && echo Done || echo Failed
166 # Tell RS server we're going down.
171 # Further initialization.
172 test -f /usr/etc/rc && sh /usr/etc/rc $action
173 test -f /usr/local/etc/rc && sh /usr/local/etc/rc $action
174 #test -f /etc/rc.rescue && sh /etc/rc.rescue $action
177 test "$action" = start -a -f /etc/issue && cat /etc/issue