178344Sobrien#!/bin/sh
278344Sobrien#
398184Sgordon# $FreeBSD$
478344Sobrien#
578344Sobrien
678344Sobrien# PROVIDE: root
778344Sobrien# REQUIRE: fsck
8136224Smtm# KEYWORD: nojail
978344Sobrien
1078344Sobrien. /etc/rc.subr
1178344Sobrien
1278344Sobrienname="root"
1378344Sobrienstart_cmd="root_start"
1478344Sobrienstop_cmd=":"
1578344Sobrien
1678344Sobrienroot_start()
1778344Sobrien{
18124622Smtm	# root normally must be read/write, but if this is a BOOTP NFS
19124622Smtm	# diskless boot it does not have to be.
20124622Smtm	#
21124622Smtm	case ${root_rw_mount} in
22124622Smtm	[Nn][Oo] | '')
23124622Smtm		;;
24124622Smtm	*)
25153029Sru		if ! mount -uw /; then
26124622Smtm			echo 'Mounting root filesystem rw failed, startup aborted'
27169668Smtm			stop_boot true
28106231Sgordon		fi
2998184Sgordon		;;
3098184Sgordon	esac
31124622Smtm
32124622Smtm	umount -a >/dev/null 2>&1
33124622Smtm
34124622Smtm	# If we booted a special kernel remove the record
35124622Smtm	# so we will boot the default kernel next time.
36155775Sru	if [ -x /sbin/nextboot ]; then
37177062Sdelphij		/sbin/nextboot -D > /dev/null 2>&1
38155775Sru	fi
3978344Sobrien}
4078344Sobrien
4178344Sobrienload_rc_config $name
4278344Sobrienrun_rc_command "$1"
43