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