mountcritremote revision 98184
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 98184 2002-06-13 22:14:37Z gordon $ 5# 6 7# PROVIDE: mountcritremote 8# REQUIRE: NETWORKING root mountcritlocal 9# KEYWORD: FreeBSD NetBSD 10 11. /etc/rc.subr 12 13name="mountcritremote" 14stop_cmd=":" 15 16case `${CMD_OSTYPE}` in 17 FreeBSD) 18 start_cmd="mountcritremote_start" 19 start_precmd="mountcritremote_precmd" 20 ;; 21NetBSD) 22 start_cmd="mountcritremote_start" 23 ;; 24esac 25 26# Mount NFS filesystems if present in /etc/fstab 27# 28# XXX When the vfsload() issues with nfsclient support and related sysctls 29# have been resolved, this block can be removed, and the condition that 30# skips nfs in the following block (for "other network filesystems") can 31# be removed. 32# 33mountcritremote_precmd() 34{ 35 case "`mount -d -a -t nfs 2> /dev/null`" in 36 *mount_nfs*) 37 # Handle absent nfs client support 38 if ! sysctl vfs.nfs >/dev/null 2>&1 ; then 39 kldload nfsclient || warn 'nfs mount ' \ 40 'requested, but no nfs client in kernel' \ 41 return 1 42 fi 43 ;; 44 esac 45 return 0 46} 47 48mountcritremote_start() 49{ 50 case `${CMD_OSTYPE}` in 51 FreeBSD) 52 # Mount nfs filesystems. 53 # 54 echo -n 'Mounting NFS file systems:' 55 mount -a -t nfs 56 echo '.' 57 58 # Mount other network filesystems if present in /etc/fstab 59 for i in ${networkfs_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} file systems:" 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 start 76 rm -f /var/run/clean_var /var/spool/lock/clean_var 77 ;; 78 NetBSD) 79 # Mount critical filesystems that may be `remote'. 80 # (as specified in $critical_filesystems_remote) 81 # This usually includes /usr. 82 # 83 mount_critical_filesystems remote 84 ;; 85 esac 86} 87 88load_rc_config $name 89run_rc_command "$1" 90