dma: better logic for guessing username
[dragonfly.git] / etc / rc.d / nfsd
blob651807240f64eba630fd3e29a72122e68160e71c
1 #!/bin/sh
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 $
8 # PROVIDE: nfsd
9 # REQUIRE: mountd
11 . /etc/rc.subr
13 name="nfsd"
14 rcvar=`set_rcvar nfs_server`
15 command="/sbin/${name}"
16 load_rc_config $name
17 command_args="${nfs_server_flags}"
18 start_precmd="nfsd_precmd"
19 sig_stop="USR1"
21 nfsd_precmd()
23 if ! sysctl vfs.nfs >/dev/null 2>&1; then
24 force_depend nfsserver || return 1
27 if ! checkyesno rpcbind_enable && \
28 ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
29 then
30 force_depend rpcbind || return 1
33 if ! checkyesno mountd_enable && \
34 ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1
35 then
36 force_depend mountd || return 1
39 if checkyesno nfs_reserved_port_only; then
40 echo 'NFS on reserved port only=YES'
41 sysctl vfs.nfs.nfs_privport=1 > /dev/null
43 return 0
46 run_rc_command "$1"