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