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" 16required_files="/etc/exports" 17start_precmd="mountd_precmd" 18extra_commands="reload" 19 20mountd_precmd() 21{ 22 23 # Load the modules now, so that the vfs.nfsd sysctl 24 # oids are available. 25 load_kld nfsd || return 1 26 27 # Do not force rpcbind to be running for an NFSv4 only server. 28 # 29 if checkyesno nfsv4_server_only; then 30 echo 'NFSv4 only server' 31 sysctl vfs.nfsd.server_min_nfsvers=4 > /dev/null 32 sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null 33 rc_flags="${rc_flags} -R" 34 else 35 force_depend rpcbind || return 1 36 if checkyesno nfsv4_server_enable; then 37 sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null 38 else 39 sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null 40 fi 41 fi 42 43 # mountd flags will differ depending on rc.conf settings 44 # 45 if checkyesno nfs_server_enable || checkyesno nfsv4_server_only; then 46 if checkyesno weak_mountd_authentication; then 47 if checkyesno nfsv4_server_only; then 48 echo -n 'weak_mountd_authentication ' 49 echo -n 'incompatible with nfsv4_server_only, ' 50 echo 'ignored' 51 else 52 rc_flags="${rc_flags} -n" 53 fi 54 fi 55 else 56 if checkyesno mountd_enable; then 57 checkyesno weak_mountd_authentication && rc_flags="-n" 58 fi 59 fi 60 61 if checkyesno zfs_enable; then 62 rc_flags="${rc_flags} /etc/exports /etc/zfs/exports" 63 fi 64 65 rm -f /var/db/mountdtab 66 ( umask 022 ; > /var/db/mountdtab ) || 67 err 1 'Cannot create /var/db/mountdtab' 68} 69 70load_rc_config $name 71run_rc_command "$1" 72