diff options
Diffstat (limited to 'libexec/rc/rc.d/root')
-rwxr-xr-x | libexec/rc/rc.d/root | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/libexec/rc/rc.d/root b/libexec/rc/rc.d/root new file mode 100755 index 000000000000..e1dad6270e7d --- /dev/null +++ b/libexec/rc/rc.d/root @@ -0,0 +1,46 @@ +#!/bin/sh +# +# + +# PROVIDE: root +# REQUIRE: fsck +# KEYWORD: nojail + +. /etc/rc.subr + +name="root" +desc="Mount root filesystem read/write" +start_cmd="root_start" +stop_cmd=":" + +root_start() +{ + # root normally must be read/write, but if this is a BOOTP NFS + # diskless boot it does not have to be. + # + case ${root_rw_mount} in + [Nn][Oo] | '') + ;; + *) + if ! mount -uw /; then + echo 'Mounting root filesystem rw failed, startup aborted' + stop_boot true + fi + ;; + esac + + umount -a >/dev/null 2>&1 + + # If we booted a special kernel remove the record + # so we will boot the default kernel next time. + if [ -x /sbin/nextboot ]; then + /sbin/nextboot -D > /dev/null 2>&1 + fi +} + +load_rc_config $name + +# doesn't make sense to run in a svcj: mounting / config setting +root_svcj="NO" + +run_rc_command "$1" |