7 # REQUIRE: mountcritremote mountd hostname gssd nfsuserd
8 # KEYWORD: nojailvnet shutdown
13 desc="Remote NFS server"
14 rcvar="nfs_server_enable"
15 command="/usr/sbin/${name}"
19 start_precmd="nfsd_precmd"
25 rc_flags="${nfs_server_flags}"
27 # Load the modules now, so that the vfs.nfsd sysctl
29 load_kld nfsd || return 1
31 if [ -n "${nfs_server_maxio}" ] && ! check_jail jailed; then
32 if ! sysctl vfs.nfsd.srvmaxio=${nfs_server_maxio} >/dev/null; then
33 warn "Failed to set server max I/O"
37 if checkyesno nfs_reserved_port_only; then
38 echo 'NFS on reserved port only=YES'
39 sysctl vfs.nfsd.nfs_privport=1 > /dev/null
41 sysctl vfs.nfsd.nfs_privport=0 > /dev/null
44 if checkyesno nfs_server_managegids; then
45 force_depend nfsuserd || err 1 "Cannot run nfsuserd"
48 if checkyesno nfsv4_server_enable; then
49 sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null
50 elif ! checkyesno nfsv4_server_only; then
51 echo 'NFSv4 is disabled'
52 sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null
55 if ! checkyesno nfsv4_server_only; then
56 force_depend rpcbind || return 1
59 force_depend mountd || return 1
60 if [ -n "${nfs_server_vhost}" ]; then
61 command_args="-V \"${nfs_server_vhost}\""