1#!/bin/sh 2# 3# 4 5# PROVIDE: mountd 6# REQUIRE: NETWORKING rpcbind quota mountlate 7# KEYWORD: nojailvnet shutdown 8 9. /etc/rc.subr 10 11name="mountd" 12desc="Service remote NFS mount requests" 13rcvar="mountd_enable" 14command="/usr/sbin/${name}" 15pidfile="/var/run/${name}.pid" 16start_precmd="mountd_precmd" 17extra_commands="reload" 18 19: ${mountd_svcj_options:="net_basic nfsd"} 20 21mountd_precmd() 22{ 23 24 # Load the modules now, so that the vfs.nfsd sysctl 25 # oids are available. 26 load_kld nfsd || return 1 27 28 # Do not force rpcbind to be running for an NFSv4 only server. 29 # 30 if checkyesno nfsv4_server_only; then 31 echo 'NFSv4 only server' 32 sysctl vfs.nfsd.server_min_nfsvers=4 > /dev/null 33 sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null 34 rc_flags="${rc_flags} -R" 35 else 36 force_depend rpcbind || return 1 37 if checkyesno nfsv4_server_enable; then 38 sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null 39 else 40 sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null 41 fi 42 fi 43 44 # mountd flags will differ depending on rc.conf settings 45 # 46 if checkyesno nfs_server_enable || checkyesno nfsv4_server_only; then 47 if checkyesno weak_mountd_authentication; then 48 if checkyesno nfsv4_server_only; then 49 echo -n 'weak_mountd_authentication ' 50 echo -n 'incompatible with nfsv4_server_only, ' 51 echo 'ignored' 52 else 53 rc_flags="${rc_flags} -n" 54 fi 55 fi 56 else 57 if checkyesno mountd_enable; then 58 checkyesno weak_mountd_authentication && rc_flags="-n" 59 fi 60 fi 61 62 if checkyesno zfs_enable; then 63 rc_flags="${rc_flags} /etc/exports /etc/zfs/exports" 64 fi 65 66 rm -f /var/db/mountdtab 67 ( umask 022 ; > /var/db/mountdtab ) || 68 err 1 'Cannot create /var/db/mountdtab' 69} 70 71load_rc_config $name 72load_rc_config nfsd 73load_rc_config zfs 74 75# precmd is not compatible with svcj 76mountd_svcj="NO" 77 78run_rc_command "$1" 79