head	1.16;
access;
symbols
	RELENG_7_4_0_RELEASE:1.15.2.1
	RELENG_7_4:1.15.2.1.0.8
	RELENG_7_4_BP:1.15.2.1
	RELENG_7_3_0_RELEASE:1.15.2.1
	RELENG_7_3:1.15.2.1.0.6
	RELENG_7_3_BP:1.15.2.1
	RELENG_7_2_0_RELEASE:1.15.2.1
	RELENG_7_2:1.15.2.1.0.4
	RELENG_7_2_BP:1.15.2.1
	RELENG_7_1_0_RELEASE:1.15.2.1
	RELENG_6_4_0_RELEASE:1.11.2.4.2.1
	RELENG_7_1:1.15.2.1.0.2
	RELENG_7_1_BP:1.15.2.1
	RELENG_6_4:1.11.2.4.0.2
	RELENG_6_4_BP:1.11.2.4
	RELENG_7_0_0_RELEASE:1.15.4.1
	RELENG_6_3_0_RELEASE:1.11.2.2
	RELENG_7_0:1.15.0.4
	RELENG_7_0_BP:1.15
	RELENG_6_3:1.11.2.2.0.2
	RELENG_6_3_BP:1.11.2.2
	RELENG_7:1.15.0.2
	RELENG_7_BP:1.15
	RELENG_6_2_0_RELEASE:1.11
	RELENG_6_2:1.11.0.8
	RELENG_6_2_BP:1.11
	RELENG_5_5_0_RELEASE:1.10.2.1
	RELENG_5_5:1.10.2.1.0.6
	RELENG_5_5_BP:1.10.2.1
	RELENG_6_1_0_RELEASE:1.11
	RELENG_6_1:1.11.0.6
	RELENG_6_1_BP:1.11
	RELENG_6_0_0_RELEASE:1.11
	RELENG_6_0:1.11.0.4
	RELENG_6_0_BP:1.11
	RELENG_6:1.11.0.2
	RELENG_6_BP:1.11
	RELENG_5_4_0_RELEASE:1.10.2.1
	RELENG_5_4:1.10.2.1.0.4
	RELENG_5_4_BP:1.10.2.1
	RELENG_5_3_0_RELEASE:1.10.2.1
	RELENG_5_3:1.10.2.1.0.2
	RELENG_5_3_BP:1.10.2.1
	RELENG_5:1.10.0.2
	RELENG_5_BP:1.10
	RELENG_5_2_1_RELEASE:1.4
	RELENG_5_2_0_RELEASE:1.4
	RELENG_5_2:1.4.0.4
	RELENG_5_2_BP:1.4
	RELENG_5_1_0_RELEASE:1.4
	RELENG_5_1:1.4.0.2
	RELENG_5_1_BP:1.4
	RELENG_5_0_0_RELEASE:1.3
	RELENG_5_0:1.3.0.2
	RELENG_5_0_BP:1.3
	head_20020621:1.1.1.2
	head_20010615:1.1.1.1
	NETBSD:1.1.1;
locks; strict;
comment	@# @;


1.16
date	2007.10.25.18.10.05;	author mtm;	state dead;
branches;
next	1.15;

1.15
date	2007.08.17.07.58.26;	author mtm;	state Exp;
branches
	1.15.2.1
	1.15.4.1;
next	1.14;

1.14
date	2007.05.17.08.57.14;	author mtm;	state Exp;
branches;
next	1.13;

1.13
date	2007.04.04.13.16.18;	author matteo;	state Exp;
branches;
next	1.12;

1.12
date	2007.03.30.19.08.58;	author mtm;	state Exp;
branches;
next	1.11;

1.11
date	2004.10.07.13.55.26;	author mtm;	state Exp;
branches
	1.11.2.1;
next	1.10;

1.10
date	2004.03.08.12.25.05;	author pjd;	state Exp;
branches
	1.10.2.1;
next	1.9;

1.9
date	2004.02.23.22.00.44;	author brueffer;	state Exp;
branches;
next	1.8;

1.8
date	2004.02.19.05.49.06;	author mtm;	state Exp;
branches;
next	1.7;

1.7
date	2004.01.17.11.06.41;	author mtm;	state Exp;
branches;
next	1.6;

1.6
date	2004.01.17.10.59.43;	author mtm;	state Exp;
branches;
next	1.5;

1.5
date	2004.01.17.10.16.38;	author mtm;	state Exp;
branches;
next	1.4;

1.4
date	2003.01.20.18.57.16;	author mtm;	state Exp;
branches;
next	1.3;

1.3
date	2002.09.06.16.18.05;	author gordon;	state Exp;
branches;
next	1.2;

1.2
date	2002.06.13.22.14.36;	author gordon;	state Exp;
branches;
next	1.1;

1.1
date	2001.06.16.07.16.14;	author obrien;	state Exp;
branches
	1.1.1.1;
next	;

1.15.2.1
date	2008.01.29.00.18.08;	author dougb;	state dead;
branches;
next	;

1.15.4.1
date	2008.01.29.00.22.33;	author dougb;	state dead;
branches;
next	;

1.11.2.1
date	2007.04.12.13.13.57;	author matteo;	state Exp;
branches;
next	1.11.2.2;

1.11.2.2
date	2007.09.26.11.02.28;	author mtm;	state Exp;
branches;
next	1.11.2.3;

1.11.2.3
date	2008.01.29.00.33.16;	author dougb;	state dead;
branches;
next	1.11.2.4;

1.11.2.4
date	2008.01.30.08.13.57;	author mtm;	state Exp;
branches
	1.11.2.4.2.1;
next	1.11.2.5;

1.11.2.5
date	2010.05.14.19.57.18;	author dougb;	state Exp;
branches;
next	1.11.2.6;

1.11.2.6
date	2012.11.17.07.39.08;	author svnexp;	state Exp;
branches;
next	;

1.11.2.4.2.1
date	2008.10.02.02.57.24;	author kensmith;	state Exp;
branches;
next	;

1.10.2.1
date	2004.10.10.09.50.54;	author mtm;	state Exp;
branches;
next	;

1.1.1.1
date	2001.06.16.07.16.14;	author obrien;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2002.06.21.19.07.21;	author obrien;	state Exp;
branches;
next	;


desc
@@


1.16
log
@Nuke rc.d/nfslocking which has been superceeded by rc.d/{lockd,statd}
@
text
@#!/bin/sh
#
# $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $
# $FreeBSD: src/etc/rc.d/nfslocking,v 1.15 2007/08/17 07:58:26 mtm Exp $
#

# PROVIDE: nfslocking
# REQUIRE: nfsserver nfsclient nfsd rpcbind
# BEFORE:  DAEMON
# KEYWORD: nojail nostart

. /etc/rc.subr

# Save the (one) commandline argument in case it gets clobbered.
arg=$1

# Either NFS client or server must be enabled and rpcbind(8) must be started.
#
nfslocking_precmd()
{
	local ret
	ret=0

	if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable
	then
		ret=1
	fi
	if ! checkyesno rpcbind_enable && \
	    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
	then
		force_depend rpcbind || ret=1
	fi

	if [ $name = "statd" ] 
	then
		rc_flags=${rpc_statd_flags}
	elif [ $name = "lockd" ]
	then
		rc_flags=${rpc_lockd_flags}
	fi

	return ${ret}
}

start_precmd="nfslocking_precmd"
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable'
status_precmd=$stop_precmd

# rpc.statd
#
name="statd"
rcvar=rpc_statd_enable
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"

# rpc.lockd
#
name="lockd"
rcvar=rpc_lockd_enable
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"
@


1.15
log
@The rc.d/nfslocking file controls two servers: rpc.statd and rpc.lockd. It worked well
in most cases, except one. The 'restart' case was not working as expected. Specifically,
it would stop both lockd and statd, but it would restart only statd (which appears first
in the script). This is because rc.subr(8) contains code to guard against infinite
recursion in the 'restart' casae.

To fix this use the traditional approach of controlling only one server from one script by
breaking out rc.d/nfslocking into its contituent parts: rc.d/lockd and rc.d/statd. Keep
rc.d/nfslocking around but don't include it in the boot rcorder(8)ing.

PR:	     conf/107316
Approved by: re (bmah)
MFC after:   2 weeks
@
text
@d4 1
a4 1
# $FreeBSD$
@


1.15.4.1
log
@MFC functional changes to etc:
1. yar's "dry run" patch to Makefile
2. Add zfs to the list of filesystems to check in
periodic/security/100.chksetuid
3. GC the nfslocking script, which has been superseded by lockd and statd
4. Add security warning to rc.d/jail
5. Add stop_cmd=':' to those rc.d scripts that do not start services,
but did not already have a stop_cmd.

And update comments in rc.firewall* and defaults/rc.conf.

Approved by:	re (kensmith)
@
text
@d4 1
a4 1
# $FreeBSD: src/etc/rc.d/nfslocking,v 1.15 2007/08/17 07:58:26 mtm Exp $
@


1.15.2.1
log
@MFC functional changes to etc:
1. yar's "dry run" patch to Makefile
2. Add zfs to the list of filesystems to check in
periodic/security/100.chksetuid
3. GC the nfslocking script, which has been superseded by lockd and statd
4. Add security warning to rc.d/jail
5. Add stop_cmd=':' to those rc.d scripts that do not start services,
but did not already have a stop_cmd.
@
text
@d4 1
a4 1
# $FreeBSD: src/etc/rc.d/nfslocking,v 1.15 2007/08/17 07:58:26 mtm Exp $
@


1.14
log
@The precmd routine does not need to check whether the command should be
"forced". If some pre-condition is not met, it should fail as it normally
does and rc.subr(8) will make the appropriate decision. Incidentally, the
previous behaviour had a bug where the "force" flag was respected only
when checking rc.conf(5) knobs. The flag was ignored when verifying the
rpcbind(8) dependency.

MFC after: 2 weeks
@
text
@d10 1
a10 1
# KEYWORD: nojail
@


1.13
log
@Add rpc_statd_flags and rpc_lockd_flags options to allow options to be
passed to rpc.statd and rpc.lockd

MFC after:	1 week
@
text
@d17 1
a17 2
# Either NFS client or server must be enabled or this must be a 'forcestart'
# for either of the daemons to start.
d21 4
a24 2
	if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable && \
	    [ -z "$rc_force" ]
d26 1
a26 1
		return 1
d31 1
a31 1
		force_depend rpcbind || return 1
d41 2
d46 1
a46 2
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable ||
    [ -n "$rc_force" ]'
@


1.12
log
@Record rc.d/nfslocking dependency on rc.d/rpcbind.

PR: conf/105465
Submitted By: ru (with minor cosmetic change)
MFC-After: 1 month
@
text
@d32 8
@


1.11
log
@Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
@
text
@d8 1
a8 1
# REQUIRE: nfsserver nfsclient nfsd
d20 16
a35 1
start_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable ||
d37 1
a37 2
stop_precmd=$start_precmd
status_precmd=$start_precmd
@


1.11.2.1
log
@MFC
	nfslocking: rev 1.12 [1] and 1.13 [2]
	rc.conf.5: rev 1.321 [2]
	rc.conf: 1.311 [2]

	[1] Record rc.d/nfslocking dependency on rc.d/rpcbind
	[2]Add rpc_statd_flags and rpc_lockd_flags options to allow
	options to be passed to rpc.statd and rpc.lockd

PR:		conf/105465 [1]
Approved by:	mtm [1]
@
text
@d8 1
a8 1
# REQUIRE: nfsserver nfsclient nfsd rpcbind
d20 1
a20 24
nfslocking_precmd()
{
	if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable && \
	    [ -z "$rc_force" ]
	then
		return 1
	fi
	if ! checkyesno rpcbind_enable && \
	    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
	then
		force_depend rpcbind || return 1
	fi

	if [ $name = "statd" ] 
	then
		rc_flags=${rpc_statd_flags}
	elif [ $name = "lockd" ]
	then
		rc_flags=${rpc_lockd_flags}
	fi
}

start_precmd="nfslocking_precmd"
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable ||
d22 2
a23 1
status_precmd=$stop_precmd
@


1.11.2.2
log
@MFC:
	  Revision  Path
	  1.82      src/etc/rc.d/Makefile
	  1.16      src/etc/rc.d/lockd
	  1.17      src/etc/rc.d/lockd
	  1.18      src/etc/rc.d/lockd
	  1.15      src/etc/rc.d/nfslocking
	  1.16      src/etc/rc.d/statd
	  1.17      src/etc/rc.d/statd

	Split rc.d/nfslocking into two separate scripts: rc.d/lockd
	and rc.d/statd. Keep rc.d/nfslocking for POLA reasons but do
	not run it during system startup.

	PR: conf/107316

	  Revision  Path
	  1.14      src/etc/rc.d/nfslocking

	The precmd routine does not need to check whether the comman
	should be "forced". If some pre-condition is not met, it should
	fail as it normally does and rc.subr(8) will make the appropriate
	decision. Incidentally, the previous behaviour had a bug where
	the "force" flag was respected only when checking rc.conf(5) knobs.
	The flag was ignored when verifying the rpcbind(8) dependency.
@
text
@d10 1
a10 1
# KEYWORD: nojail nostart
d17 2
a18 1
# Either NFS client or server must be enabled and rpcbind(8) must be started.
d22 2
a23 4
	local ret
	ret=0

	if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable
d25 1
a25 1
		ret=1
d30 1
a30 1
		force_depend rpcbind || ret=1
a39 2

	return ${ret}
d43 2
a44 1
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable'
@


1.11.2.3
log
@MFC a more limited set of changes that make sense for this branch:

1. GC the nfslocking script, which has been superseded by lockd and statd
2. Add security warning to rc.d/jail
3. Add stop_cmd=':' to those rc.d scripts that do not start services,
but did not already have a stop_cmd.
@
text
@d4 1
a4 1
# $FreeBSD: src/etc/rc.d/nfslocking,v 1.11.2.2 2007/09/26 11:02:28 mtm Exp $
@


1.11.2.4
log
@Add back rc.d/nfslocking. It would be a violation of POLA to remove
this file from a -stable branch.
@
text
@d4 1
a4 1
# $FreeBSD$
@


1.11.2.5
log
@SVN rev 208096 on 2010-05-14 19:57:18Z by dougb

MFC 208060:

Remove trailing white space. No functional changes.

Hand-delete trailing ws from rc.subr, rc.d/nsswitch, and rc.d/nfslocking
while I'm here.
@
text
@d34 1
a34 1
	if [ $name = "statd" ]
@


1.11.2.6
log
@Switch importer
@
text
@d4 1
a4 1
# $FreeBSD: stable/6/etc/rc.d/nfslocking 208096 2010-05-14 19:57:18Z dougb $
@


1.11.2.4.2.1
log
@SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)
@
text
@@


1.10
log
@Mark scripts as not usable inside a jail by adding keyword 'nojail'.

Some suggestions from:	rwatson, Ruben de Groot <mail25@@bzerk.org>
@
text
@d10 1
a10 1
# KEYWORD: FreeBSD nojail
@


1.10.2.1
log
@RCS file: /home/ncvs/src/etc/rc,v
----------------------------
revision 1.335
date: 2004/10/08 14:23:49;  author: mtm;  state: Exp;  lines: +0 -1
Remove an unused variable.

Submitted by: Pawel Worach <pawel.worach@@telia.com>
----------------------------
revision 1.334
date: 2004/10/07 13:55:25;  author: mtm;  state: Exp;  lines: +1 -1
Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
=============================================================================
RCS file: /home/ncvs/src/etc/rc.d/nsswitch,v
----------------------------
revision 1.4
date: 2004/09/16 17:03:12;  author: keramida;  state: Exp;  lines: +1 -1
Fix requirement of `network' to `NETWORK' because the former isn't
provided by any rc.d script.

Approved by:	mtm
=============================================================================
RCS file: /home/ncvs/src/etc/rc.d/pflog,v
----------------------------
revision 1.3
date: 2004/09/16 17:04:20;  author: keramida;  state: Exp;  lines: +1 -1
We don't have any providers of `beforenetlkm' in FreeBSD.  Remove the
dependency to it from our rc.d scripts.

Approved by:	mtm
=============================================================================

Approved by: re/scottl
@
text
@d10 1
a10 1
# KEYWORD: nojail
@


1.9
log
@Fix typo
@
text
@d10 1
a10 1
# KEYWORD: FreeBSD
@


1.8
log
@In-line documentation.

Prodded by: alfred
@
text
@d14 1
a14 1
# Save the (one) commandline argument incase it gets clobbered.
@


1.7
log
@Remove variables whose sole purpose was to make easier to
work with the NetBSD specific stuff.
@
text
@d14 1
d17 3
d25 2
d33 2
@


1.6
log
@Luke Mewburn has indicated that they (NetBSD) are not interested
in keeping the scripts under rc.d in sync with us. So, remove
NetBSD specific stuff (which made our scripts more complicated
than necessary).

The NetBSD ident string will be left intact, both for history and
also incase we wish to pull in future versions.
@
text
@d16 2
a17 7
RCVAR_SERVER="nfs_server_enable"
RCVAR_CLIENT="nfs_client_enable"
RCVAR_STATD="rpc_statd_enable"
RCVAR_LOCKD="rpc_lockd_enable"

start_precmd='checkyesno ${RCVAR_SERVER} || checkyesno ${RCVAR_CLIENT} ||
		[ -n "$rc_force" ]'
d22 1
a22 1
rcvar=${RCVAR_STATD}
d28 1
a28 1
rcvar=${RCVAR_LOCKD}
@


1.5
log
@Luke Mewburn has indicated that they (NetBSD) are not interested
in keeping the scripts under rc.d in sync with us. So, begin removal
of NetBSD specific stuff (which made our scripts more complicated
than necessary), starting with the NetBSD KEYWORD.
@
text
@d16 4
a19 14
case ${OSTYPE} in
FreeBSD)
	RCVAR_SERVER="nfs_server_enable"
	RCVAR_CLIENT="nfs_client_enable"
	RCVAR_STATD="rpc_statd_enable"
	RCVAR_LOCKD="rpc_lockd_enable"
	;;
NetBSD)
	RCVAR_SERVER="nfs_server"
	RCVAR_CLIENT="nfs_client"
	RCVAR_STATD="statd"
	RCVAR_LOCKD="lockd"
	;;
esac
@


1.4
log
@Add a missing OR.

Approved by: markm (mentor)(implicit)
@
text
@d10 1
a10 1
# KEYWORD: FreeBSD NetBSD
@


1.3
log
@Convert from `${CMD_OSTYPE}` to ${OSTYPE}. This saves a shell invocation on
OS-dependent case switches.
@
text
@d31 2
a32 2
start_precmd="checkyesno ${RCVAR_SERVER} || checkyesno ${RCVAR_CLIENT}
		[ -n "$rc_force" ]"
@


1.2
log
@Merge in all the changes that Mike Makonnen has been maintaining for a
while. This is only the script pieces, the glue for the build comes next.

Submitted by:	Mike Makonnen <makonnen@@pacbell.net>
Reviewed by:	silence on -current and -hackers
Prodded by:	rwatson
@
text
@d16 1
a16 1
case `${CMD_OSTYPE}` in
@


1.1
log
@Initial revision
@
text
@d3 2
a4 1
# $NetBSD: nfslocking,v 1.3 2000/05/13 08:45:07 lukem Exp $
d8 3
a10 1
# REQUIRE: nfsd
d16 17
a32 1
start_precmd='checkyesno nfs_server || checkyesno nfs_client'
d37 1
a37 1
rcvar=$name
d43 1
a43 1
rcvar=$name
@


1.1.1.1
log
@Import the NetBSD 1.5 RC system.

Note that `rc' and `rc.shutdown' could not be imported because we already
have files with those names.
@
text
@@


1.1.1.2
log
@Sync with NetBSD's mainline.
@
text
@d3 1
a3 1
# $NetBSD: nfslocking,v 1.5 2002/03/22 04:33:59 thorpej Exp $
a7 1
# BEFORE:  DAEMON
d13 1
a13 2
start_precmd='checkyesno nfs_server || checkyesno nfs_client ||
		[ -n "$rc_force" ]'
@

