root revision 103019
1275970Scy#!/bin/sh
2275970Scy#
3275970Scy# $NetBSD: root,v 1.2 2000/05/13 08:45:09 lukem Exp $
4275970Scy# $FreeBSD: head/etc/rc.d/root 103019 2002-09-06 16:18:05Z gordon $
5275970Scy#
6275970Scy
7275970Scy# PROVIDE: root
8275970Scy# REQUIRE: fsck
9275970Scy# KEYWORD: FreeBSD NetBSD
10275970Scy
11275970Scy. /etc/rc.subr
12275970Scy
13275970Scyname="root"
14275970Scystart_cmd="root_start"
15275970Scystop_cmd=":"
16275970Scy
17275970Scyroot_start()
18275970Scy{
19275970Scy	case ${OSTYPE} in
20275970Scy	FreeBSD)
21275970Scy		# root normally must be read/write, but if this is a BOOTP NFS
22275970Scy		# diskless boot it does not have to be.
23275970Scy		#
24275970Scy		case ${root_rw_mount} in
25275970Scy		[Nn][Oo] | '')
26275970Scy			;;
27275970Scy		*)
28275970Scy			if ! mount -u -o rw / ; then
29275970Scy				echo 'Mounting root filesystem rw failed, startup aborted'
30275970Scy				exit 1
31275970Scy			fi
32275970Scy			;;
33275970Scy		esac
34275970Scy
35275970Scy		umount -a >/dev/null 2>&1
36275970Scy		mount /
37275970Scy
38275970Scy		# If we booted a special kernel remove the record
39275970Scy		# so we will boot the default kernel next time.
40275970Scy		[ -e /boot/nextkernel ] && rm -f /boot/nextkernel
41275970Scy		;;
42275970Scy	NetBSD)
43275970Scy		umount -a >/dev/null 2>&1
44275970Scy		mount /
45275970Scy		rm -f /fastboot
46275970Scy		;;
47275970Scy	esac
48275970Scy}
49275970Scy
50275970Scyload_rc_config $name
51275970Scyrun_rc_command "$1"
52275970Scy