mountcritremote revision 298514
1#!/bin/sh 2# 3# $FreeBSD: head/etc/rc.d/mountcritremote 298514 2016-04-23 16:10:54Z lme $ 4# 5 6# PROVIDE: mountcritremote 7# REQUIRE: NETWORKING FILESYSTEMS ipsec netwait 8# KEYWORD: nojail 9 10. /etc/rc.subr 11 12name="mountcritremote" 13desc="Mount critical remote filesystems" 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 nfscl || return 1 31 ;; 32 esac 33 return 0 34} 35 36mountcritremote_start() 37{ 38 # Mount nfs filesystems. 39 # 40 case "`/sbin/mount -d -a -t nfs`" in 41 '') 42 ;; 43 *) 44 echo -n 'Mounting NFS filesystems:' 45 mount -a -t nfs 46 echo '.' 47 ;; 48 esac 49 50 # Mount other network filesystems if present in /etc/fstab. 51 case ${extra_netfs_types} in 52 [Nn][Oo]) 53 ;; 54 *) 55 netfs_types="${netfs_types} ${extra_netfs_types}" 56 ;; 57 esac 58 59 for i in ${netfs_types}; do 60 fstype=${i%:*} 61 fsdecr=${i#*:} 62 63 [ "${fstype}" = "nfs" ] && continue 64 65 case "`mount -d -a -t ${fstype}`" in 66 *mount_${fstype}*) 67 echo -n "Mounting ${fsdecr} filesystems:" 68 mount -a -t ${fstype} 69 echo '.' 70 ;; 71 esac 72 done 73 74 # Cleanup /var again just in case it's a network mount. 75 /etc/rc.d/cleanvar quietreload 76 rm -f /var/run/clean_var /var/spool/lock/clean_var 77} 78 79load_rc_config $name 80run_rc_command "$1" 81