Subject: Re: admin script for ipfilter
To: Geert Hendrickx <ghen@NetBSD.org>
From: Darren Reed <darrenr@NetBSD.org>
List: tech-userlevel
Date: 12/27/2006 14:38:43
On Wed, Dec 27, 2006 at 11:16:50AM +0100, Geert Hendrickx wrote:
> On Wed, Dec 27, 2006 at 12:04:47AM +0000, Darren Reed wrote:
> > So...the attached script, "ipfadm", I'm curious for feedback on.
> > 
> > The idea is to do "ipfadm enable ipfilter" or "ipfadm disable ipfilter"
> > and it updates the relevant rc.d config file for you.
> > 
> > Ok, not catchy...
> > 
> > What I hope is of more interest is doing "ipfadm ipfilter status",
> > where it will tell you if it is enabled, disabled, enabled but no rules,
> > or disabled but rules loaded.
> > 
> > Feedback welcome.
> 
> Why not generalise this to "rc.dadmin enable/disable/status XXX" to toggle
> arbitrary startup scripts?  You could still add ipfilter-specific hooks (as
> well as for other rc.d scripts) for the "status" command.

In order to do this, the last line of every script would need to be
changed from

run_rc_command "$1"

to

if [ $# -ge 1 ] ; then
	run_rc_command "$1"
fi

This is so another script can do ". /etc/rc.d/foo" and not actually
action anything.

Is that likely to be a problem?

Darren