nfsd revision 223847
1#!/bin/sh 2# 3# $FreeBSD: head/etc/rc.d/nfsd 223847 2011-07-07 20:59:42Z rmacklem $ 4# 5 6# PROVIDE: nfsd 7# REQUIRE: mountd hostname gssd nfsuserd 8# KEYWORD: nojail shutdown 9 10. /etc/rc.subr 11 12name="nfsd" 13rcvar=`set_rcvar nfs_server` 14command="/usr/sbin/${name}" 15 16load_rc_config $name 17start_precmd="nfsd_precmd" 18sig_stop="USR1" 19 20nfsd_precmd() 21{ 22 if checkyesno oldnfs_server_enable; then 23 rc_flags="-o ${nfs_server_flags}" 24 25 # Load the module now, so that the vfs.nfsrv sysctl 26 # oids are available. 27 load_kld nfsserver 28 29 if checkyesno nfs_reserved_port_only; then 30 echo 'NFS on reserved port only=YES' 31 sysctl vfs.nfsrv.nfs_privport=1 > /dev/null 32 fi 33 else 34 rc_flags="${nfs_server_flags}" 35 36 # Load the modules now, so that the vfs.nfsd sysctl 37 # oids are available. 38 load_kld nfsd 39 40 if checkyesno nfs_reserved_port_only; then 41 echo 'NFS on reserved port only=YES' 42 sysctl vfs.nfsd.nfs_privport=1 > /dev/null 43 fi 44 45 if checkyesno nfsv4_server_enable; then 46 if ! checkyesno nfsuserd_enable && \ 47 ! /etc/rc.d/nfsuserd forcestatus 1>/dev/null 2>&1 48 then 49 if ! force_depend nfsuserd; then 50 err 1 "Cannot run nfsuserd" 51 fi 52 fi 53 else 54 echo 'NFSv4 is disabled' 55 sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null 56 fi 57 fi 58 59 if ! checkyesno rpcbind_enable && \ 60 ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 61 then 62 force_depend rpcbind || return 1 63 fi 64 65 if ! checkyesno mountd_enable && \ 66 ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1 67 then 68 force_depend mountd || return 1 69 fi 70 return 0 71} 72 73run_rc_command "$1" 74