Subject: Re: ups-nut rc.d scripts
To: Frederick Bruckman <fredb@immanent.net>
From: Johnny Lam <jlam@jgrind.org>
List: tech-pkg
Date: 11/20/2001 11:16:59
On Tue, Nov 20, 2001 at 12:38:10PM -0600, Frederick Bruckman wrote:
> On Tue, 20 Nov 2001, Johnny Lam wrote:
> 
> > 	I'm trying to improve the ups-nut rc.d scripts to the point that
> > they may be automatically copied into /etc/rc.d without any harmful effects.
> > That means that they must respect any rc.conf settings so that they don't
> > automatically start unless the proper variables are set to YES.
> 
> That's taken care of by these lines...
> 
> > rcvar="upsd"
> 
> > rcvar="${name}"
> 
> [But, shouldn't you set them both to "${name}", for consistency?]

I'm not sure I understand your point.  The upsd script has one variable
"upsd" controlling the start of two programs.  The upsmon script is simpler
as it only needs to control one program, so it just looks like one of the
other rc.d scripts in /etc/rc.d.

> The only thing with that is, "rc" is going to complain if you fail to
> set "upsd" and "upsmon" in "/etc/rc.conf". There really should be a
> default (maybe in "/etc/defaults/pkg.rc.conf"??).

Well, the warning gets printed, but it's harmless, and I think it's beneficial
because it reminds the user that he needs to add something to /etc/rc.conf
in order to get the daemon to start.  Or, we could add something like:

if [ -n "${rcvar}" ]; then
        if eval test -z \$${rcvar}; then
		eval ${rcvar}=NO
        fi
fi

to each pkgsrc rc.d script so that the default action is to silently disable
the rc.d script.  As I said, I like the warning.  Can you explain why you
wouldn't want to have the warning displayed?

	Thanks,

	-- Johnny Lam <jlam@jgrind.org>