Merge remote-tracking branch 'remotes/crater/vendor/BYACC'
[dragonfly.git] / etc / rc.d / root
1 #!/bin/sh
2 #
3 # $NetBSD: root,v 1.2 2000/05/13 08:45:09 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/root,v 1.5 2002/10/31 02:06:05 gordon Exp $
5 #
6
7 # PROVIDE: root
8 # REQUIRE: fsck
9
10 . /etc/rc.subr
11
12 name="root"
13 start_cmd="root_start"
14 stop_cmd=":"
15
16 root_start()
17 {
18         # root normally must be read/write, but if this is a BOOTP NFS
19         # diskless boot it does not have to be.
20         #
21         case ${root_rw_mount} in
22         [Nn][Oo] | '')
23                 ;;
24         *)
25                 if ! mount -u -o rw /; then
26                         echo 'Mounting root filesystem rw failed; startup aborted'
27                         stop_boot true
28                 fi
29                 ;;
30         esac
31         umount -a >/dev/null 2>&1
32
33         # If we booted a special kernel remove the record
34         # so we will boot the default kernel next time.
35         if [ -e /boot/nextkernel ]; then
36                 rm -f /boot/nextkernel
37         fi
38 }
39
40 load_rc_config $name
41 run_rc_command "$1"