Subject: Re: Proposed rc.d/rc.conf[.d] changes....
To: Eduardo Horvath <>
From: Scott Aaron Bamford <>
List: tech-userlevel
Date: 05/08/2000 23:01:13
On Mon, 8 May 2000, Eduardo Horvath wrote:

>On Mon, 8 May 100, Darren Reed wrote:
>I don't want to see yet another directory of scripts that need to be kept
>in sync with the stuff in /etc/rc.d.  In addition to the maintenance issue
>is the overhead of .sourcing each one of these little scripts.

as far as i can tell from what ive read and what people have told me
rc.conf.d's main reason for even being sugested is for drop-in scripts.
if the defaults are stored in the script i see no reason for having this,
just have rc.conf.

>Let me propose the following:
>Have a section at the head of the scripts with all the configuration
>variables, possibly bracketed by specific comments so the contents can be
>mechanically extracted.  It would look something like this:

Please please please dont add more magic comments, since rc.conf has to be
parsed _after_ defaults we can pretty safely assume the end of a defaults when
we hit
 . "/etc/rc.conf" (or . "/etc/rc.subr")
and rcorder takes the first non-comment line after the start of its magic
comments as its end (correct me if im wrong here?) so that could mark the start
and end without the need to add any more magic comments.

	# $NetBSD: amd,v 1.2 2000/04/15 21:14:50 tsarna Exp $

	# PROVIDE: amd
	# REQUIRE: portmap mountall ypbind
(non comment line after rcorders magic comments, start here)
	# This section configures amd and this comment would end up in
	# /etc/rc.conf
	amd_flags=${amd_flags:="-l syslog -x error,noinfo,nostats"}
	amd_dir=${amd_dir:=/amd}			# mount dir
	amd_master=${amd_master:=/etc/amd/master}	# master map

(external config file is sourced, thats the end of our defaults)
	. /etc/rc.subr
	. /etc/rc.conf

	command_args='-p -a '$amd_dir' `sed s/#.*$// <'$amd_master'`

	run_rc_command "$1"

Thats how i have my system setup currently (putting the defaults in the
rc.d script is only like hardcodenig a default into a program. it _isnt_
configurable information).

>These would be the default settings.  A script would then be run to
>extract these variables from everything in /etc/rc.d and deposit the
>default values in /etc/rc.conf.  You can then override the defaults by
>editting /etc/rc.conf.

it would also be easy for a script/little program that took these values
and appened them to the end of a rc.conf (optionaly as some people will
go ape if their rc.conf gets touched by automated scripts) by pkgsrc
makeing it easy to drop scripts in.

>> My main concern with NetBSD's rc implementation is the problem of controlling
>> what gets started at bootup and what gets stopped when you shutdown.  Having
>> two separate directories (/etc/rc.d and /etc/init.d) without adding S/K only
>> alleviates one side of the problem.  I'm beginning to think that it may even
>> need to be rototilled as the shutdown side of things didn't seem to be very
>> well thought through during design/implementation by any of us.
>I like the idea of adding an /etc/init.d to hold the primary copies of the
>rc scripts and copying/symlinking/hardlinking them to an entry in
>/etc/rc.d to enable them.  It's clean and you can immediately tell what's
>enabled and what's disabled.  

i think /etc/init.d would be nice too, with /etc/shutdown.d or similar.

while on the point, if a scripts presence in /etc/rc.d/ is going to be
used for enableing the script _please_ also alow SCRIPT=YES lines to do
so too, from what i can tell changing checkyesno() in rc.subr to return
true if yes or notset (oposite of what it currently returns for not set)
would alow both methods, (setting SCRIPT=NO in rc.conf will turn it off,
no entry in rc.conf would default to on since its been put in rc.d).

>I don't want to se the S/K stuff which is ugly and a maintenance
>nightmare, and I see no need for that or an /etc/shutdown.d since that
>should be handled by PROVIDE/REQUIRE.  If it was started on the way up, it
>should be turned off on the way down.

yes yes yes yes, please dont put S/K stuff in... that looks so messy, when
i first got linux i looked at them and just thought it was crazy.
on the other hand i came to NetBSD (sure i had more unix experince by then)
and picked up rc.local and rc.conf and was amazed at how simple it was
to do things like this.

>Eduardo Horvath				   
 - Scott
 ------------------------------ `6_6  )   `-.  (     ).`-.__.`) |        (_Y_.)'  ._   )  `._ `. ``-..-' |      _..`--'_..-_/  /--'_.' ,'
 --------------------------- (il),-''  (li),'  ((!.-' ----