2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $NetBSD: mountcritremote,v 1.7 2002/04/29 12:29:53 lukem Exp $
|
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: mountcritremote
|
2005-10-12 22:14:44 +00:00
|
|
|
# REQUIRE: NETWORKING root mountcritlocal cleanvar ipsec
|
2004-10-07 13:55:26 +00:00
|
|
|
# KEYWORD: nojail
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="mountcritremote"
|
|
|
|
stop_cmd=":"
|
2004-01-17 10:59:43 +00:00
|
|
|
start_cmd="mountcritremote_start"
|
|
|
|
start_precmd="mountcritremote_precmd"
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
# Mount NFS filesystems if present in /etc/fstab
|
|
|
|
#
|
|
|
|
# XXX When the vfsload() issues with nfsclient support and related sysctls
|
|
|
|
# have been resolved, this block can be removed, and the condition that
|
|
|
|
# skips nfs in the following block (for "other network filesystems") can
|
|
|
|
# be removed.
|
|
|
|
#
|
|
|
|
mountcritremote_precmd()
|
|
|
|
{
|
|
|
|
case "`mount -d -a -t nfs 2> /dev/null`" in
|
|
|
|
*mount_nfs*)
|
|
|
|
# Handle absent nfs client support
|
2002-10-12 10:31:31 +00:00
|
|
|
if ! sysctl vfs.nfs >/dev/null 2>&1; then
|
2005-12-30 09:16:23 +00:00
|
|
|
kldload nfsclient || { warn 'nfs mount ' \
|
|
|
|
'requested, but no nfs client in kernel'; \
|
|
|
|
return 1; }
|
2002-06-13 22:14:37 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
mountcritremote_start()
|
|
|
|
{
|
2004-01-17 10:59:43 +00:00
|
|
|
# Mount nfs filesystems.
|
|
|
|
#
|
|
|
|
echo -n 'Mounting NFS file systems:'
|
|
|
|
mount -a -t nfs
|
|
|
|
echo '.'
|
2002-06-13 22:14:37 +00:00
|
|
|
|
2004-01-17 10:59:43 +00:00
|
|
|
# Mount other network filesystems if present in /etc/fstab.
|
|
|
|
case ${extra_netfs_types} in
|
|
|
|
[Nn][Oo])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
netfs_types="${netfs_types} ${extra_netfs_types}"
|
|
|
|
;;
|
|
|
|
esac
|
2003-06-01 01:43:37 +00:00
|
|
|
|
2004-01-17 10:59:43 +00:00
|
|
|
for i in ${netfs_types}; do
|
|
|
|
fstype=${i%:*}
|
|
|
|
fsdecr=${i#*:}
|
2002-06-13 22:14:37 +00:00
|
|
|
|
2004-01-17 10:59:43 +00:00
|
|
|
[ "${fstype}" = "nfs" ] && continue
|
2002-06-13 22:14:37 +00:00
|
|
|
|
2004-01-17 10:59:43 +00:00
|
|
|
case "`mount -d -a -t ${fstype}`" in
|
|
|
|
*mount_${fstype}*)
|
|
|
|
echo -n "Mounting ${fsdecr} file systems:"
|
|
|
|
mount -a -t ${fstype}
|
|
|
|
echo '.'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2002-06-13 22:14:37 +00:00
|
|
|
|
2004-01-17 10:59:43 +00:00
|
|
|
# Cleanup /var again just in case it's a network mount.
|
|
|
|
/etc/rc.d/cleanvar reload
|
|
|
|
rm -f /var/run/clean_var /var/spool/lock/clean_var
|
2002-06-13 22:14:37 +00:00
|
|
|
}
|
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|