1#!/bin/sh
2#
3#
4
5# PROVIDE: mountcritlocal
6# REQUIRE: root hostid_save mdconfig
7# KEYWORD: nojail shutdown
8
9. /etc/rc.subr
10
11name="mountcritlocal"
12desc="Mount critical local filesystems"
13start_cmd="mountcritlocal_start"
14stop_cmd=sync
15
16mountcritlocal_start()
17{
18	local err holders waited
19
20	# Set up the list of network filesystem types for which mounting
21	# should be delayed until after network initialization.
22	case ${extra_netfs_types} in
23	[Nn][Oo])
24		;;
25	*)
26		netfs_types="${netfs_types} ${extra_netfs_types}"
27		;;
28	esac
29
30	# Mount everything except nfs filesystems.
31	startmsg -n 'Mounting local 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
39	mount -a -t ${mount_excludes}
40	err=$?
41	if [ ${err} -ne 0 ]; then
42		echo 'Mounting /etc/fstab filesystems failed,' \
43		    'will retry after root mount hold release'
44		root_hold_wait
45		mount -a -t ${mount_excludes}
46		err=$?
47	fi
48
49	startmsg '.'
50
51	case ${err} in
52	0)
53		;;
54	*)
55		echo 'Mounting /etc/fstab filesystems failed,' \
56		    'startup aborted'
57		stop_boot true
58		;;
59	esac
60}
61
62load_rc_config $name
63
64# mounting shall not be performed in a svcj
65mountcritlocal_svcj="NO"
66
67run_rc_command "$1"
68