Subject: Re: rc.d scripts and there variable settings (was: CVS commit: sharesrc/share/man/man5)
To: Robert Elz <kre@munnari.OZ.AU>
From: Jim Bernard <jbernard@mines.edu>
List: tech-pkg
Date: 09/06/2002 07:41:20
On Thu, Sep 05, 2002 at 07:07:20PM +0700, Robert Elz wrote:
> Date: Tue, 3 Sep 2002 22:33:18 +0200
> From: Bernd Ernesti <netbsd@lists.veego.de>
> Message-ID: <20020903203318.GA5600@arresum.veego.de>
>
> | This is what I don't like about the current installation of a package.
> |
> | I want to use a package package in the future, but not right now, so
> | I install it and then I get a lot of warnings about unconfigured variables
> | during the next boot.
>
> The last time this was discussed, I thought the final conclusion was
> that pkgsrc installed rc.d scripts should all be something like:
> (using the uninstalled script from openldap as an example)
>
...
> name="slapd"
> rcvar=${name}
> command="@PREFIX@/libexec/${name}"
> pidfile="/var/openldap/slapd.pid"
> required_files="@PKG_SYSCONFDIR@/${name}.conf"
> extra_commands="reload"
>
> # Add a line containing slapd=YES to /etc/rc.conf to enable slapd
> # Do not alter the following line.
> eval "\$$rcvar=NO"
...
> The "eval" (which is probably overkill, as the value of $rcvar is known...)
> is essentially the script carrying around its own little piece of
> /etc/defaults/rc.conf.
Except that, as written, it doesn't accomplish the desired goal. It
should say:
eval "$rcvar=NO"
in order to set slapd=NO. The original version evaluates to "=NO" if slapd
is not set or to "YES=NO" if slapd=YES, neither of which is useful.
I wonder if it might not be better just to modify rc.subr to deal with
an undfined rcvar (treating that as equivalent to NO). Then rc.d scripts
wouldn't be burdened with setting their own defaults. Perhaps an associated
warning message would then be useful as a reminder that the package hasn't
been configured explicitly to run or not to run.
--Jim