1#!/bin/sh 2# 3# $FreeBSD$ 4# 5 6# PROVIDE: mountd 7# REQUIRE: NETWORKING rpcbind quota mountlate 8# KEYWORD: nojail shutdown 9 10. /etc/rc.subr 11 12name="mountd" 13desc="Service remote NFS mount requests" 14rcvar="mountd_enable" 15command="/usr/sbin/${name}" 16pidfile="/var/run/${name}.pid" 17required_files="/etc/exports" 18start_precmd="mountd_precmd" 19extra_commands="reload" 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 72run_rc_command "$1" 73