nfsd revision 230099
121118Sache#!/bin/sh 221118Sache# 321118Sache# $FreeBSD: head/etc/rc.d/nfsd 230099 2012-01-14 02:18:41Z dougb $ 421118Sache# 521118Sache 621118Sache# PROVIDE: nfsd 721118Sache# REQUIRE: mountd hostname gssd nfsuserd 821118Sache# KEYWORD: nojail shutdown 921118Sache 1021118Sache. /etc/rc.subr 1121118Sache 1221118Sachename="nfsd" 1321118Sachercvar="nfs_server_enable" 1421118Sachecommand="/usr/sbin/${name}" 1521118Sache 1621118Sacheload_rc_config $name 1721118Sachestart_precmd="nfsd_precmd" 1821118Sachesig_stop="USR1" 1921118Sache 2021118Sachenfsd_precmd() 2121118Sache{ 2221118Sache if checkyesno oldnfs_server_enable; then 2321118Sache rc_flags="-o ${nfs_server_flags}" 2421118Sache 2521118Sache # Load the module now, so that the vfs.nfsrv sysctl 2621118Sache # oids are available. 2721118Sache load_kld nfsserver 2821118Sache 2921118Sache if checkyesno nfs_reserved_port_only; then 3021118Sache echo 'NFS on reserved port only=YES' 3121118Sache sysctl vfs.nfsrv.nfs_privport=1 > /dev/null 3221118Sache else 3321118Sache sysctl vfs.nfsrv.nfs_privport=0 > /dev/null 3421118Sache fi 3521118Sache else 3621118Sache rc_flags="${nfs_server_flags}" 3721118Sache 3821118Sache # Load the modules now, so that the vfs.nfsd sysctl 39 # oids are available. 40 load_kld nfsd 41 42 if checkyesno nfs_reserved_port_only; then 43 echo 'NFS on reserved port only=YES' 44 sysctl vfs.nfsd.nfs_privport=1 > /dev/null 45 else 46 sysctl vfs.nfsd.nfs_privport=0 > /dev/null 47 fi 48 49 if checkyesno nfsv4_server_enable; then 50 sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null 51 if ! checkyesno nfsuserd_enable && \ 52 ! /etc/rc.d/nfsuserd forcestatus 1>/dev/null 2>&1 53 then 54 if ! force_depend nfsuserd; then 55 err 1 "Cannot run nfsuserd" 56 fi 57 fi 58 else 59 echo 'NFSv4 is disabled' 60 sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null 61 fi 62 fi 63 64 if ! checkyesno rpcbind_enable && \ 65 ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 66 then 67 force_depend rpcbind || return 1 68 fi 69 70 if ! checkyesno mountd_enable && \ 71 ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1 72 then 73 force_depend mountd || return 1 74 fi 75 return 0 76} 77 78run_rc_command "$1" 79