On Wed, Jan 23, 2008 at 11:31:51AM -0800, Doug Barton wrote: > Henrik Brix Andersen wrote: >> On Tue, Jan 22, 2008 at 09:51:08AM +0800, Rong-En Fan wrote: >>> On Mon, Jan 21, 2008 at 12:45:02PM -0800, Doug Barton wrote: >>>> The script looks good, thanks for doing this! The only thing I would >>>> point out is that the default _enable=no is not needed, since rc.subr >>>> needs to see one of the values for "yes" in order to do anything. No >>>> harm leaving it in, I just wanted to point out that it's not strictly >>>> necessary. >>> Thanks. I see most of our /etc/rc.d/* scripts does not have this. >>> But most ports' have as our Porter's Handbook have such example. >> I believe this is actually required for rc scripts supplied by >> ports. Scripts included in the base wont need it, since their default >> settings are already present in /etc/defaults/rc.conf. >> I just tried removing the default setting for '$bitlbee_enable' in the >> rc script for irc/bitlbee, I did recently. It then results in the >> following error when '$bitlbee_enable' is undefined: >> # /usr/local/etc/rc.d/bitlbee rcvar >> # bitlbee >> /usr/local/etc/rc.d/bitlbee: WARNING: $bitlbee_enable is not set properly >> - see rc.conf(5). >> bitlbee_enable=NO > > Hrrm, that's annoying. :) Ignore what I said then, if it's doing that (and > I don't think it _should_, but that's another issue) then you need the > default. Sorry for the noise.
It's done that from day one with rc.d since foo_enable variables are checked with checkyesno(). If we wanted to not have to set them, adding a default argument to checkyesno is certainly easy enough to do following the pattern in network.subr's get_if_var(), but I'm not sure it would be of much value. -- Brooks
pgpSxXK0IAFZJ.pgp
Description: PGP signature