xref: /dragonfly/etc/rc.d/mountcritlocal (revision 2d8a3be7)
1#!/bin/sh
2#
3# $NetBSD: mountcritlocal,v 1.7 2002/04/29 12:29:53 lukem Exp $
4# $FreeBSD: src/etc/rc.d/mountcritlocal,v 1.5 2003/06/01 01:43:37 gordon Exp $
5# $DragonFly: src/etc/rc.d/mountcritlocal,v 1.1 2003/07/24 06:35:37 dillon Exp $
6#
7
8# PROVIDE: mountcritlocal
9# REQUIRE: root
10# KEYWORD: DragonFly FreeBSD NetBSD
11
12. /etc/rc.subr
13
14name="mountcritlocal"
15start_cmd="mountcritlocal_start"
16stop_cmd=":"
17
18mountcritlocal_start()
19{
20	case ${OSTYPE} in
21	DragonFly)
22
23                # Set up the list of network filesystem types for which mounting
24                # should be delayed until after network initialization.
25                case ${extra_netfs_types} in
26                [Nn][Oo])
27                        ;;
28                *)
29                        netfs_types="${netfs_types} ${extra_netfs_types}"
30                        ;;
31                esac
32
33                # Mount everything except nfs filesystems.
34                mount_excludes='no'
35                for i in ${netfs_types}; do
36                        fstype=${i%:*}
37                        mount_excludes="${mount_excludes}${fstype},"
38                done
39                mount_excludes=${mount_excludes%,}
40                mount -a -t ${mount_excludes}
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
52	FreeBSD)
53		# Set up the list of network filesystem types for which mounting
54		# should be delayed until after network initialization.
55		case ${extra_netfs_types} in
56		[Nn][Oo])
57			;;
58		*)
59			netfs_types="${netfs_types} ${extra_netfs_types}"
60			;;
61		esac
62
63		# Mount everything except nfs filesystems.
64		mount_excludes='no'
65		for i in ${netfs_types}; do
66			fstype=${i%:*}
67			mount_excludes="${mount_excludes}${fstype},"
68		done
69		mount_excludes=${mount_excludes%,}
70		mount -a -t ${mount_excludes}
71
72		case $? in
73		0)
74			;;
75		*)
76			echo 'Mounting /etc/fstab filesystems failed,' \
77			    ' startup aborted'
78			exit 1
79			;;
80		esac
81		;;
82	NetBSD)
83		#	Mount critical filesystems that are `local'
84		#	(as specified in $critical_filesystems_local)
85		#	This usually includes /var.
86		#
87		mount_critical_filesystems local
88
89		#	clean up left-over files.
90		#	this could include the cleanup of lock files and /var/run, etc.
91		#
92		rm -f /etc/nologin /var/spool/lock/LCK.* /var/spool/uucp/STST/*
93		(cd /var/run && rm -rf -- *)
94		;;
95	esac
96}
97
98load_rc_config $name
99run_rc_command "$1"
100