mountcritlocal revision 123533
1#!/bin/sh
2#
3# $NetBSD: mountcritlocal,v 1.7 2002/04/29 12:29:53 lukem Exp $
4# $FreeBSD: head/etc/rc.d/mountcritlocal 123533 2003-12-14 13:36:36Z seanc $
5#
6
7# PROVIDE: mountcritlocal
8# REQUIRE: root
9# KEYWORD: FreeBSD NetBSD
10
11. /etc/rc.subr
12
13name="mountcritlocal"
14start_cmd="mountcritlocal_start"
15stop_cmd=":"
16
17mountcritlocal_start()
18{
19	case ${OSTYPE} in
20	FreeBSD)
21		# Set up the list of network filesystem types for which mounting
22		# should be delayed until after network initialization.
23		case ${extra_netfs_types} in
24		[Nn][Oo])
25			;;
26		*)
27			netfs_types="${netfs_types} ${extra_netfs_types}"
28			;;
29		esac
30
31		# Mount everything except nfs filesystems.
32		mount_excludes='no'
33		for i in ${netfs_types}; do
34			fstype=${i%:*}
35			mount_excludes="${mount_excludes}${fstype},"
36		done
37		mount_excludes=${mount_excludes%,}
38		mount -a -t ${mount_excludes}
39
40		case $? in
41		0)
42			;;
43		*)
44			echo 'Mounting /etc/fstab filesystems failed,' \
45			    ' startup aborted'
46			kill -QUIT $$
47			;;
48		esac
49		;;
50	NetBSD)
51		#	Mount critical filesystems that are `local'
52		#	(as specified in $critical_filesystems_local)
53		#	This usually includes /var.
54		#
55		mount_critical_filesystems local
56
57		#	clean up left-over files.
58		#	this could include the cleanup of lock files and /var/run, etc.
59		#
60		rm -f /etc/nologin /var/spool/lock/LCK.* /var/spool/uucp/STST/*
61		(cd /var/run && rm -rf -- *)
62		;;
63	esac
64}
65
66load_rc_config $name
67run_rc_command "$1"
68