mountcritremote revision 174438
1#!/bin/sh
2#
3# $FreeBSD: head/etc/rc.d/mountcritremote 174438 2007-12-08 07:20:23Z dougb $
4#
5
6# PROVIDE: mountcritremote
7# REQUIRE: NETWORKING FILESYSTEMS cleanvar ipsec
8# KEYWORD: nojail
9
10. /etc/rc.subr
11
12name="mountcritremote"
13stop_cmd=":"
14start_cmd="mountcritremote_start"
15start_precmd="mountcritremote_precmd"
16
17# Mount NFS filesystems if present in /etc/fstab
18#
19# XXX When the vfsload() issues with nfsclient support and related sysctls
20# have been resolved, this block can be removed, and the condition that
21# skips nfs in the following block (for "other network filesystems") can
22# be removed.
23#
24mountcritremote_precmd()
25{
26	case "`mount -d -a -t nfs 2> /dev/null`" in
27	*mount_nfs*)
28		# Handle absent nfs client support
29		load_kld -m nfs nfsclient || return 1
30		;;
31	esac
32	return 0
33}
34
35mountcritremote_start()
36{
37	# Mount nfs filesystems.
38	#
39	echo -n 'Mounting NFS file systems:'
40	mount -a -t nfs
41	echo '.'
42
43	# Mount other network filesystems if present in /etc/fstab.
44	case ${extra_netfs_types} in
45	[Nn][Oo])
46		;;
47	*)
48		netfs_types="${netfs_types} ${extra_netfs_types}"
49		;;
50	esac
51
52	for i in ${netfs_types}; do
53		fstype=${i%:*}
54		fsdecr=${i#*:}
55
56		[ "${fstype}" = "nfs" ] && continue
57
58		case "`mount -d -a -t ${fstype}`" in
59		*mount_${fstype}*)
60			echo -n "Mounting ${fsdecr} file systems:"
61			mount -a -t ${fstype}
62			echo '.'
63			;;
64		esac
65	done
66
67	# Cleanup /var again just in case it's a network mount.
68	/etc/rc.d/cleanvar reload
69	rm -f /var/run/clean_var /var/spool/lock/clean_var
70}
71
72load_rc_config $name
73run_rc_command "$1"
74