xref: /dragonfly/etc/rc.d/nfsd (revision 0db87cb7)
1#!/bin/sh
2#
3# $NetBSD: nfsd,v 1.4 2001/06/16 06:13:10 lukem Exp $
4# $FreeBSD: src/etc/rc.d/nfsd,v 1.9 2003/01/24 00:37:52 mtm Exp $
5# $DragonFly: src/etc/rc.d/nfsd,v 1.5 2005/11/19 21:47:32 swildner Exp $
6#
7
8# PROVIDE: nfsd
9# REQUIRE: mountd
10# KEYWORD: shutdown
11
12. /etc/rc.subr
13
14name="nfsd"
15rcvar=`set_rcvar nfs_server`
16command="/sbin/${name}"
17load_rc_config $name
18command_args="${nfs_server_flags}"
19start_precmd="nfsd_precmd"
20sig_stop="USR1"
21
22nfsd_precmd()
23{
24	if ! sysctl vfs.nfs >/dev/null 2>&1; then
25		force_depend nfsserver || return 1
26	fi
27
28	if ! checkyesno rpcbind_enable  && \
29	    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
30	then
31		force_depend rpcbind || return 1
32	fi
33
34	if ! checkyesno mountd_enable  && \
35	    ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1
36	then
37		force_depend mountd || return 1
38	fi
39
40	if checkyesno nfs_reserved_port_only; then
41		echo 'NFS on reserved port only=YES'
42		sysctl vfs.nfs.nfs_privport=1 > /dev/null
43	fi
44	return 0
45}
46
47run_rc_command "$1"
48