aboutsummaryrefslogtreecommitdiff
path: root/libexec/rc/rc.d/root
blob: e1dad6270e7d0461310f6e3c34895bc6d8b73a63 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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"