mountcritlocal revision 103019
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 103019 2002-09-06 16:18:05Z gordon $
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		networkfs_types='nfs:NFS smbfs:SMB portalfs:PORTAL'
24		case ${extra_netfs_types} in
25		[Nn][Oo])
26			;;
27		*)
28			networkfs_types="${networkfs_types} ${extra_netfs_types}"
29			;;
30		esac
31
32		# Mount everything except nfs filesystems.
33		mount_excludes='no'
34		for i in ${networkfs_types}; do
35			fstype=${i%:*}
36			mount_excludes="${mount_excludes}${fstype},"
37		done
38		mount_excludes=${mount_excludes%,}
39		mount -a -t ${mount_excludes}
40
41		case $? in
42		0)
43			;;
44		*)
45			echo 'Mounting /etc/fstab filesystems failed,' \
46			    ' startup aborted'
47			exit 1
48			;;
49		esac
50		;;
51	NetBSD)
52		#	Mount critical filesystems that are `local'
53		#	(as specified in $critical_filesystems_local)
54		#	This usually includes /var.
55		#
56		mount_critical_filesystems local
57
58		#	clean up left-over files.
59		#	this could include the cleanup of lock files and /var/run, etc.
60		#
61		rm -f /etc/nologin /var/spool/lock/LCK.* /var/spool/uucp/STST/*
62		(cd /var/run && rm -rf -- *)
63		;;
64	esac
65}
66
67load_rc_config $name
68run_rc_command "$1"
69