2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: nfsd
|
2009-06-02 22:15:47 +00:00
|
|
|
# REQUIRE: mountd hostname gssd nfsuserd
|
2008-07-16 19:50:29 +00:00
|
|
|
# KEYWORD: nojail shutdown
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="nfsd"
|
2016-04-23 16:10:54 +00:00
|
|
|
desc="Remote NFS server"
|
2012-01-14 02:18:41 +00:00
|
|
|
rcvar="nfs_server_enable"
|
2002-07-07 22:19:08 +00:00
|
|
|
command="/usr/sbin/${name}"
|
2002-06-13 22:14:37 +00:00
|
|
|
|
2003-01-24 00:37:52 +00:00
|
|
|
load_rc_config $name
|
2004-01-17 10:59:43 +00:00
|
|
|
start_precmd="nfsd_precmd"
|
|
|
|
sig_stop="USR1"
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
nfsd_precmd()
|
|
|
|
{
|
2015-04-18 16:08:06 +00:00
|
|
|
rc_flags="${nfs_server_flags}"
|
|
|
|
|
|
|
|
# Load the modules now, so that the vfs.nfsd sysctl
|
|
|
|
# oids are available.
|
|
|
|
load_kld nfsd
|
|
|
|
|
|
|
|
if checkyesno nfs_reserved_port_only; then
|
|
|
|
echo 'NFS on reserved port only=YES'
|
|
|
|
sysctl vfs.nfsd.nfs_privport=1 > /dev/null
|
|
|
|
else
|
|
|
|
sysctl vfs.nfsd.nfs_privport=0 > /dev/null
|
|
|
|
fi
|
|
|
|
|
2015-11-30 22:29:11 +00:00
|
|
|
if checkyesno nfsv4_server_enable || \
|
|
|
|
checkyesno nfs_server_managegids; then
|
|
|
|
force_depend nfsuserd || err 1 "Cannot run nfsuserd"
|
|
|
|
fi
|
|
|
|
|
2015-04-18 16:08:06 +00:00
|
|
|
if checkyesno nfsv4_server_enable; then
|
|
|
|
sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null
|
2011-04-26 00:22:17 +00:00
|
|
|
else
|
2015-04-18 16:08:06 +00:00
|
|
|
echo 'NFSv4 is disabled'
|
|
|
|
sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null
|
2002-06-13 22:14:37 +00:00
|
|
|
fi
|
|
|
|
|
2012-02-14 10:51:24 +00:00
|
|
|
force_depend rpcbind || return 1
|
|
|
|
force_depend mountd || return 1
|
2002-06-13 22:14:37 +00:00
|
|
|
}
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
run_rc_command "$1"
|