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 13:00:07
On Tue, Nov 20, 2001 at 02:19:52PM -0600, Frederick Bruckman wrote:
> On Tue, 20 Nov 2001, Johnny Lam wrote:
>
> > 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?
>
> There's nothing wrong with the warning as such. I'm not suggesting it be
> suppressed, I'm suggesting it be satisfied. There should be defaults for
> the package "rc.d" scripts just like there are defaults for the other
> "rc.d" scripts.
>
> It would not be difficult to write an "INSTALL" script that appends to
> "/etc/rc.conf" only if the variable in question is not already set
> there, but that would be wrong. It would also be wrong to modify
> "/etc/defaults/rc.conf", since that gets overwritten when NetBSD is
> upgraded. My considered opinion, is that we should have "/etc/rc.conf"
> source one more file for the package defaults, and I suggest we call it
> something like "/etc/defaults/pkg.rc.conf".
I see something in /usr/src/sbin/chkconfig that we could use for this
purpose, but it's apparently not available until NetDSD 1.6 (not sure why).
So given that we can't use chkconfig, I think your idea of
/etc/defaults/pkg.rc.conf is nicer than mine, which is to duplicate that
5-line shell code snippet I wrote above across all of the pkgsrc rc.d
scripts. It's pretty simple to add more goop to
pkgsrc/mk/install/{,de}install to amend pkg.rc.conf during pkg_{add,delete}.
The only downside I see is that pkg.rc.conf will becomes obsolete in 1.6 if
we are really switching over to using chkconfig, which is where I think we're
headed as chkconfig can be used by tools like sysinst and sushi. At that
point, I think we'll want pkgsrc to use chkconfig as well.
All of this comes into play only if we automatically copy the rc.d scripts
in ${LOCALBASE}/etc/rc.d into /etc/rc.d. There's code in the common
INSTALL/DEINSTALL scripts in pkgsrc/mk/install to do this if the package
Makefile sets RCD_SCRIPTS appropriately. None of this applies to packages
that haven't been converted to use bsd.pkg.install.mk.
Cheers,
-- Johnny Lam <jlam@jgrind.org>