2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: mountcritremote
|
2012-09-11 05:04:59 +00:00
|
|
|
# REQUIRE: NETWORKING FILESYSTEMS ipsec netwait
|
2004-10-07 13:55:26 +00:00
|
|
|
# KEYWORD: nojail
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="mountcritremote"
|
2016-04-23 16:10:54 +00:00
|
|
|
desc="Mount critical remote filesystems"
|
2001-06-16 07:16:14 +00:00
|
|
|
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
|
2011-06-11 21:14:22 +00:00
|
|
|
load_kld -m nfs nfscl || return 1
|
2002-06-13 22:14:37 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
mountcritremote_start()
|
|
|
|
{
|
2016-05-30 19:59:51 +00:00
|
|
|
local mounted_remote_filesystem=false
|
|
|
|
|
2004-01-17 10:59:43 +00:00
|
|
|
# Mount nfs filesystems.
|
|
|
|
#
|
2008-06-22 15:40:19 +00:00
|
|
|
case "`/sbin/mount -d -a -t nfs`" in
|
|
|
|
'')
|
|
|
|
;;
|
|
|
|
*)
|
2016-05-30 19:59:51 +00:00
|
|
|
mounted_remote_filesystem=true
|
2016-04-23 16:10:54 +00:00
|
|
|
echo -n 'Mounting NFS filesystems:'
|
2008-06-22 15:40:19 +00:00
|
|
|
mount -a -t nfs
|
|
|
|
echo '.'
|
|
|
|
;;
|
|
|
|
esac
|
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}*)
|
2016-05-30 19:59:51 +00:00
|
|
|
mounted_remote_filesystem=true
|
2016-04-23 16:10:54 +00:00
|
|
|
echo -n "Mounting ${fsdecr} filesystems:"
|
2004-01-17 10:59:43 +00:00
|
|
|
mount -a -t ${fstype}
|
|
|
|
echo '.'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2002-06-13 22:14:37 +00:00
|
|
|
|
2016-05-30 19:59:51 +00:00
|
|
|
if $mounted_remote_filesystem; then
|
|
|
|
# Cleanup /var again just in case it's a network mount.
|
|
|
|
/etc/rc.d/cleanvar quietreload
|
|
|
|
rm -f /var/run/clean_var /var/spool/lock/clean_var
|
|
|
|
|
|
|
|
# Regenerate the ldconfig hints in case there are additional
|
|
|
|
# library paths on remote file systems
|
|
|
|
/etc/rc.d/ldconfig quietstart
|
|
|
|
fi
|
2002-06-13 22:14:37 +00:00
|
|
|
}
|
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|