Subject: Re: rc.d scripts and there variable settings (was: CVS commit: sharesrc/share/man/man5)
To: None <>
From: Robert Elz <kre@munnari.OZ.AU>
List: tech-pkg
Date: 09/05/2002 19:07:20
    Date:        Tue, 3 Sep 2002 22:33:18 +0200
    From:        Bernd Ernesti <>
    Message-ID:  <>

  | 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)

#! /bin/sh
# $NetBSD:,v 1.1 2002/01/30 07:34:01 jlam Exp $
# OpenLDAP standalone LDAP daemon
# PROVIDE: slapd

if [ -f /etc/rc.subr ]
        . /etc/rc.subr


# Add a line containing slapd=YES to /etc/rc.conf to enable slapd
# Do not alter the following line.
eval "\$$rcvar=NO"

if [ -f /etc/rc.subr ]
        load_rc_config $name
        run_rc_command "$1"
        @ECHO@ -n " ${name}"
        ${command} ${slapd_flags} ${command_args}

The "eval" (which is probably overkill, as the value of $rcvar is known...)
is essentially the script carrying around its own little piece of

With this, the warnings will go away, and without you having to remember to
add thing=NO to rc.conf whenever one of the daemon type packages is installed.

A warning in a MESSAGE file that the daemon won't start until enabled in 
rc.conf would be a good idea.

So would a rc.conf variable that enables rc.subr to list all the things
that aren't being started, as well as all the things that are, and when
possible why ("disabled", "prerequisite file X not found", ...)


ps: for the script above, for old systems, with no rc.conf. from where is
the script supposed to obtain command_args ?   (I believe I saw a checkin
that set a value for slapd_flags in the script, that one belongs there).
If "nowhere" is the answer (for command_args) why bother including it
on the command line (just to create confusion) ?