summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/mountcritlocal
blob: 7f3566616c55f80666b3f3f31b479940f23d16df (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
#
# $NetBSD: mountcritlocal,v 1.7 2002/04/29 12:29:53 lukem Exp $
# $FreeBSD$
#

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

. /etc/rc.subr

name="mountcritlocal"
start_cmd="mountcritlocal_start"
stop_cmd=":"

mountcritlocal_start()
{
	case ${OSTYPE} in
	FreeBSD)
		# Set up the list of network filesystem types for which mounting
		# should be delayed until after network initialization.
		networkfs_types='nfs:NFS smbfs:SMB portalfs:PORTAL nwfs:NWFS'
		case ${extra_netfs_types} in
		[Nn][Oo])
			;;
		*)
			networkfs_types="${networkfs_types} ${extra_netfs_types}"
			;;
		esac

		# Mount everything except nfs filesystems.
		mount_excludes='no'
		for i in ${networkfs_types}; do
			fstype=${i%:*}
			mount_excludes="${mount_excludes}${fstype},"
		done
		mount_excludes=${mount_excludes%,}
		mount -a -t ${mount_excludes}

		case $? in
		0)
			;;
		*)
			echo 'Mounting /etc/fstab filesystems failed,' \
			    ' startup aborted'
			exit 1
			;;
		esac
		;;
	NetBSD)
		#	Mount critical filesystems that are `local'
		#	(as specified in $critical_filesystems_local)
		#	This usually includes /var.
		#
		mount_critical_filesystems local

		#	clean up left-over files.
		#	this could include the cleanup of lock files and /var/run, etc.
		#
		rm -f /etc/nologin /var/spool/lock/LCK.* /var/spool/uucp/STST/*
		(cd /var/run && rm -rf -- *)
		;;
	esac
}

load_rc_config $name
run_rc_command "$1"
OpenPOWER on IntegriCloud