Subject: Re: Possible design of the new rc.d rc.conf stuff.
To: None <erh@nimenees.com>
From: Paul Goyette <paul@whooppee.com>
List: current-users
Date: 04/17/2000 17:55:29
On Mon, 17 Apr 2000 erh@nimenees.com wrote:

> To make the selection of which config to prefer as transparent to rc.d/*
> as possible a rc_init function would be added to rc.subr which would look
> something like:
> -=-=-=-=-=-=-=-=-=-=-=-
> rc_init()
> {
> 	conf_dir_preferred=`(. /etc/rc.conf ; echo $conf_dir_preferred)`
> 	if checkyesno conf_dir_preferred ; then
> 	    if [ -r /etc/rc.config/`basename $0` ]; then
> 		. /etc/rc.config/`basename $0`
> 	    fi
> 	    . /etc/rc.conf
> 	else
> 	    . /etc/rc.conf
> 	    if [ -r /etc/rc.config/`basename $0` ] ; then
> 		. /etc/rc.conf/`basename $0`
> 	    fi
> 	fi
> }
> -=-=-=-=-=-=-=-=-=-=-=-
> 
> 
> And a rc.d/foo script would look like:
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> # PROVIDE: foo
> # REQUIRE: noodle
> #
> # DEFAULT: foo=NO
> # DEFAULT: foo_flags="-x"
> 
> . /etc/rc.subr
> rc_init
> 
> ...rest of file...
> -=-=-=-=-=-=-=-=-=-=-=-
> 
> 	So the result would be:
> If you want a monolithic rc.conf you set conf_dir_preferred=YES,
> "rm /etc/rc.config/*" and add configuration lines to rc.conf.  
> 
> If you want split configuration files set conf_dir_preferred=NO, delete
> all configuration lines (if any) from rc.conf and create or edit the
> the appropriate files in /etc/rc.config.

I think I don't like the name or sense of the variable!  :)

If I _prefer_ the /etc/rc.config/* stuff, then it should be sourced
_after_ the /etc/rc.conf file, so that it's values can override and
therefore be preferred.  With the variable name and sense the way you've
written it, I should set conf_dir_preferred=YES to prefer the values set
in /etc/rc.d - this seems backwards!

So, either change the name of the variable (maybe to something like
monolithic_conf_preferred) or change the sense of YES and NO.

> 	So what problems does anyone see with this?

Someone earlier in this thread suggested that it would be useful to have
some kind of warning if a variable were defined in both the /etc/rc.conf
and /etc/rc.config/* files.  I think that that would be useful, too, but
I admit I can't see any easy way to implement it.

Just my $0.02 (which I don't have any more, after having paid my darned
income taxes today)!


-----------------------------------------------------------------------
|   Paul Goyette  | PGP DSS Key fingerprint:  | E-mail addresses:     |
| Network Engineer|  BCD7 5301 9513 58A6 0DBC |  paul@whooppee.com    |
| & kernel hacker |  91EB ADB1 A280 3B79 9221 |  pgoyette@juniper.net |
-----------------------------------------------------------------------