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"
26 # Function to dynamically start a system service
28 service $opt up /sbin/$service "$@"
31 while getopts 'saf' opt
34 s) sflag=t ;; # Single user
35 a) aflag=t ;; # Ask for /usr
36 f) fflag=t ;; # Force a full file system check
40 shift `expr $OPTIND - 1`
43 1:start|1:stop|1:down)
51 echo -n "Multiuser startup in progress ...:"
54 test -f /etc/keymap && loadkeys /etc/keymap
56 # options for fsck. default is -r, which prompts the user for repairs.
57 fsckopts="`sysenv fsckopts`"
62 if [ "`sysenv debug_fkeys`" != 0 ]
64 upopt -n is -period 5HZ
74 # Try to read the hardware real-time clock, otherwise do it manually.
75 readclock || intr date -q
78 printroot >/etc/mtab # /etc/mtab keeps track of mounts
79 >/etc/utmp # /etc/utmp keeps track of logins
81 # /etc/fstab lists the root, tmp and usr devices.
84 # Unmount now defunct ramdisk
85 umount /dev/imgrd > /dev/null || echo "Failed to unmount boot ramdisk"
87 # Use MFS binary only from kernel image?
88 if [ "`sysenv bin_img`" = 1 ]
93 # Are we booting from CD?
94 bootcd="`/bin/sysenv bootcd`"
96 # If booting from CD, /usr has to be mounted readonly.
97 # Also, $usr won't be specified correctly in the
98 # fstab (the CD could be anywhere), so we decide
99 # where it is based on sysenv (set by FS when probing for CD).
102 #imagedev="`/bin/sysenv cdproberoot`"
103 #usrdev="`expr $imagedev + 1`"
106 echo "Setting /usr on cd is $usr"
110 # Mount the /usr partition unless this is a single floppy Minix.
113 if [ "$aflag" -o "$usr" = unknown ]
115 # We need to ask what the /usr du jour is.
117 echo -n "Finish the name of device to mount as /usr: /dev/"
119 echo "usr=/dev/$usr" >/tmp/usr'
123 mount $bin_img $usr_roflag $usr /usr || {
125 Please try to mount something else as /usr, then hit CTRL-D to continue startup.
126 Mount $usr /usr failed -- Single user."
132 # Check if the system crashed.
136 echo "The system was not properly shut down. Checking file systems."
143 echo "fsck / - $root"
144 intr fsck $fsckopts $root
145 echo "fsck /usr - $usr"
146 intr fsck $fsckopts $usr
148 then echo "fsck /home - $home"
149 intr fsck $fsckopts $home
151 mount $bin_img $usr /usr
155 then mount $bin_img $home /home || echo "WARNING: couldn't mount $home on /home"
158 # This file is necessary for above 'shutdown -C' check.
159 # (Silence stderr in case of running from cd.)
160 touch /usr/adm/wtmp 2>/dev/null
168 case "`printroot -r`":$bootcd in
170 # Remove boot-only things to make space,
171 # unless booting from CD, in which case we need them.
173 # put the compiler on ram
174 cp /usr/lib/em* /usr/lib/cpp* /lib
177 # Things should be alright now.
181 # Tell RS server we're going down.
186 # Further initialization.
187 test -f /usr/etc/rc && sh /usr/etc/rc $action
188 test -f /usr/local/etc/rc && sh /usr/local/etc/rc $action
191 test "$action" = start -a -f /etc/issue && cat /etc/issue