summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/root
blob: b521e6f7ef6ad866b0dbf318a476ca92950eb0b6 (plain)
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
47
48
49
50
51
52
53
#!/bin/sh
#
# $NetBSD: root,v 1.2 2000/05/13 08:45:09 lukem Exp $
# $FreeBSD$
#

# PROVIDE: root
# REQUIRE: fsck
# KEYWORD: FreeBSD NetBSD

. /etc/rc.subr

name="root"
start_cmd="root_start"
stop_cmd=":"

root_start()
{
	case ${OSTYPE} in
	FreeBSD)
		# 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 -u -o rw /; then
				echo 'Mounting root filesystem rw failed, startup aborted'
				exit 1
			fi
			;;
		esac

		umount -a >/dev/null 2>&1
		mount /

		# If we booted a special kernel remove the record
		# so we will boot the default kernel next time.
		if [ -e /boot/nextkernel ]; then
			rm -f /boot/nextkernel
		fi
		;;
	NetBSD)
		umount -a >/dev/null 2>&1
		mount /
		rm -f /fastboot
		;;
	esac
}

load_rc_config $name
run_rc_command "$1"
OpenPOWER on IntegriCloud