#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: root
# begin Isilon
# require was fsck but we handle that here
# REQUIRE: isi_bootdisk_init
# end Isilon
# KEYWORD: nojail

. /etc/rc.subr

name="root"
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] | '')
		;;
	*)
		# Isilion-specific:
		# Don't remove the "-o current", or else this will clobber our
		# root mount options set in isi_imdd_start (e.g. noatime)
		if ! mount -uw -o current /; 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
run_rc_command "$1"
