xref: /freebsd/libexec/rc/rc.d/mountcritlocal (revision 43a5ec4eb41567cc92586503212743d89686d78f)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# PROVIDE: mountcritlocal
7# REQUIRE: root hostid_save mdconfig
8# KEYWORD: nojail shutdown
9
10. /etc/rc.subr
11
12name="mountcritlocal"
13desc="Mount critical local filesystems"
14start_cmd="mountcritlocal_start"
15stop_cmd=sync
16
17mountcritlocal_start()
18{
19	local err holders waited
20
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	check_startmsgs && echo -n 'Mounting local filesystems:'
33	mount_excludes='no'
34	for i in ${netfs_types}; do
35		fstype=${i%:*}
36		mount_excludes="${mount_excludes}${fstype},"
37	done
38	mount_excludes=${mount_excludes%,}
39
40	mount -a -t ${mount_excludes}
41	err=$?
42	if [ ${err} -ne 0 ]; then
43		echo 'Mounting /etc/fstab filesystems failed,' \
44		    'will retry after root mount hold release'
45		root_hold_wait
46		mount -a -t ${mount_excludes}
47		err=$?
48	fi
49
50	check_startmsgs && echo '.'
51
52	case ${err} in
53	0)
54		;;
55	*)
56		echo 'Mounting /etc/fstab filesystems failed,' \
57		    'startup aborted'
58		stop_boot true
59		;;
60	esac
61}
62
63load_rc_config $name
64run_rc_command "$1"
65