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