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"
|
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()
|
|
|
|
{
|
2011-04-26 00:22:17 +00:00
|
|
|
if checkyesno oldnfs_server_enable; then
|
|
|
|
rc_flags="-o ${nfs_server_flags}"
|
2009-06-02 22:15:47 +00:00
|
|
|
|
2011-07-07 20:59:42 +00:00
|
|
|
# Load the module now, so that the vfs.nfsrv sysctl
|
|
|
|
# oids are available.
|
|
|
|
load_kld nfsserver
|
2009-06-02 22:15:47 +00:00
|
|
|
|
|
|
|
if checkyesno nfs_reserved_port_only; then
|
|
|
|
echo 'NFS on reserved port only=YES'
|
|
|
|
sysctl vfs.nfsrv.nfs_privport=1 > /dev/null
|
2011-11-05 16:47:47 +00:00
|
|
|
else
|
|
|
|
sysctl vfs.nfsrv.nfs_privport=0 > /dev/null
|
2009-06-02 22:15:47 +00:00
|
|
|
fi
|
2011-04-26 00:22:17 +00:00
|
|
|
else
|
|
|
|
rc_flags="${nfs_server_flags}"
|
|
|
|
|
2011-05-08 01:01:27 +00:00
|
|
|
# Load the modules now, so that the vfs.nfsd sysctl
|
2011-04-26 00:22:17 +00:00
|
|
|
# oids are available.
|
|
|
|
load_kld nfsd
|
|
|
|
|
|
|
|
if checkyesno nfs_reserved_port_only; then
|
|
|
|
echo 'NFS on reserved port only=YES'
|
2011-05-08 01:01:27 +00:00
|
|
|
sysctl vfs.nfsd.nfs_privport=1 > /dev/null
|
2011-11-05 16:47:47 +00:00
|
|
|
else
|
|
|
|
sysctl vfs.nfsd.nfs_privport=0 > /dev/null
|
2011-04-26 00:22:17 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if checkyesno nfsv4_server_enable; then
|
2011-11-05 16:47:47 +00:00
|
|
|
sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null
|
2012-02-14 10:51:24 +00:00
|
|
|
force_depend nfsuserd || err 1 "Cannot run nfsuserd"
|
2011-04-26 00:22:17 +00:00
|
|
|
else
|
|
|
|
echo 'NFSv4 is disabled'
|
2011-05-08 01:01:27 +00:00
|
|
|
sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null
|
2011-04-26 00:22:17 +00:00
|
|
|
fi
|
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"
|