xref: /dragonfly/etc/rc.d/root (revision 9f7604d7)
1#!/bin/sh
2#
3# $NetBSD: root,v 1.2 2000/05/13 08:45:09 lukem Exp $
4# $FreeBSD: src/etc/rc.d/root,v 1.5 2002/10/31 02:06:05 gordon Exp $
5# $DragonFly: src/etc/rc.d/root,v 1.4 2005/11/19 21:47:32 swildner Exp $
6#
7
8# PROVIDE: root
9# REQUIRE: fsck
10
11. /etc/rc.subr
12
13name="root"
14start_cmd="root_start"
15stop_cmd=":"
16
17root_start()
18{
19	# root normally must be read/write, but if this is a BOOTP NFS
20	# diskless boot it does not have to be.
21	#
22	case ${root_rw_mount} in
23	[Nn][Oo] | '')
24		;;
25	*)
26		if ! mount -u -o rw /; then
27			echo 'Mounting root filesystem rw failed, startup aborted'
28			exit 1
29		fi
30		;;
31	esac
32	umount -a >/dev/null 2>&1
33	mount /
34	# If we booted a special kernel remove the record
35	# so we will boot the default kernel next time.
36	if [ -e /boot/nextkernel ]; then
37		rm -f /boot/nextkernel
38	fi
39}
40
41load_rc_config $name
42run_rc_command "$1"
43