xref: /freebsd/libexec/rc/rc.d/root (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1#!/bin/sh
2#
3#
4
5# PROVIDE: root
6# REQUIRE: fsck
7# KEYWORD: nojail
8
9. /etc/rc.subr
10
11name="root"
12desc="Mount root filesystem read/write"
13start_cmd="root_start"
14stop_cmd=":"
15
16root_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 -uw /; then
26			echo 'Mounting root filesystem rw failed, startup aborted'
27			stop_boot true
28		fi
29		;;
30	esac
31
32	umount -a >/dev/null 2>&1
33
34	# If we booted a special kernel remove the record
35	# so we will boot the default kernel next time.
36	if [ -x /sbin/nextboot ]; then
37		/sbin/nextboot -D > /dev/null 2>&1
38	fi
39}
40
41load_rc_config $name
42run_rc_command "$1"
43