1 # /etc/rc - System startup script run by init before going multiuser.
9 PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin
10 RC_TZ=/etc/rc.timezone
15 echo >&2 "Usage: $0 [-saf] start|stop|down"
24 # Function to dynamically start a system service
26 service up /sbin/$service "$@"
29 while getopts 'saf' opt
32 s) sflag=t ;; # Single user
33 a) aflag=t ;; # Ask for /usr
34 f) fflag=t ;; # Force a full file system check
38 shift `expr $OPTIND - 1`
41 1:start|1:stop|1:down)
49 echo -n "Multiuser startup in progress ...:"
52 test -f /etc/keymap && loadkeys /etc/keymap
54 if [ "`sysenv debug_fkeys`" != 0 ]
66 # Try to read the hardware real-time clock, otherwise do it manually.
67 readclock || intr date -q
70 printroot >/etc/mtab # /etc/mtab keeps track of mounts
71 >/etc/utmp # /etc/utmp keeps track of logins
73 # /etc/fstab lists the root, tmp and usr devices.
76 # Unmount now defunct ramdisk
77 umount /dev/imgrd > /dev/null || echo "Failed to unmount boot ramdisk"
79 # Use MFS binary only from kernel image?
80 if [ "`sysenv bin_img`" = 1 ]
85 # Are we booting from CD?
86 bootcd="`/bin/sysenv bootcd`"
88 # If booting from CD, /usr has to be mounted readonly.
89 # Also, $usr won't be specified correctly in the
90 # fstab (the CD could be anywhere), so we decide
91 # where it is based on sysenv (set by FS when probing for CD).
94 #imagedev="`/bin/sysenv cdproberoot`"
95 #usrdev="`expr $imagedev + 1`"
98 echo "Setting /usr on cd is $usr"
102 # Mount the /usr partition unless this is a single floppy Minix.
105 if [ "$aflag" -o "$usr" = unknown ]
107 # We need to ask what the /usr du jour is.
109 echo -n "Finish the name of device to mount as /usr: /dev/"
111 echo "usr=/dev/$usr" >/tmp/usr'
115 mount $bin_img $usr_roflag $usr /usr || {
117 Please try to mount something else as /usr, then hit CTRL-D to continue startup.
118 Mount $usr /usr failed -- Single user."
124 # Check if the system crashed.
128 echo "The system was not properly shut down. Checking file systems."
135 echo "fsck / - $root"
137 echo "fsck /usr - $usr"
140 then echo "fsck /home - $home"
143 mount $bin_img $usr /usr
147 then mount $bin_img $home /home || echo "WARNING: couldn't mount $home on /home"
150 # This file is necessary for above 'shutdown -C' check.
151 # (Silence stderr in case of running from cd.)
152 touch /usr/adm/wtmp 2>/dev/null
160 case "`printroot -r`":$bootcd in
162 # Remove boot-only things to make space,
163 # unless booting from CD, in which case we need them.
165 # put the compiler on ram
166 cp /usr/lib/em* /usr/lib/cpp* /lib
169 # Things should be alright now.
173 # Tell RS server we're going down.
178 # Further initialization.
179 test -f /usr/etc/rc && sh /usr/etc/rc $action
180 test -f /usr/local/etc/rc && sh /usr/local/etc/rc $action
183 test "$action" = start -a -f /etc/issue && cat /etc/issue