Subject: Re: Allowing ${name}_path to be set in "rc.conf", was Re: Keeping /etc/defaults and /etc/rc.d in-sync
To: John Nemeth <jnemeth@victoria.tc.ca>
From: Andrew Brown <atatat@atatdot.net>
List: tech-userlevel
Date: 01/04/2002 17:09:52
>...
>     I would certainly support this option.  Ultimately, I would like
>to see a copy of the contents of /etc/defaults stashed somewhere (i.e.
>/etc/origs), and then have /etc/defaults moved back to /etc (I really
>hate that scheme and it is one of the biggest things I hate about
>SysV).  Once this is done, updates could be done by doing a three way
>merge between old /etc/origs, old /etc, and new /etc/origs.

the whole point of having a /etc/defaults directory and then a layer
above that people can wreck is that systemic upgrades *won't* require
a three-way merge.  i like it the way it is.  i guess we'll have to
disagree.  :-/

getting back to the original point (this was the original point,
wasn't it?), the /etc/rc.conf.d directory really is very useful.  my
/etc/rc.conf contains this:

	sshd=pkgsrc

and my /etc/rc.conf.d/sshd file contains this:

	if [ "$sshd" = pkgsrc ]; then
		sshd=YES
		command="/usr/pkg/sbin/${name}"
		required_files="/etc/${name}_config"
		start_precmd=:
		extra_commands="reload"
	fi

and that's all i needed to do to use the sshd from pkgsrc instead of
the openssh one.  i can even switch back with one setting if i want
to.  but i don't like it (again, my opinion), so i don't think i will.

note: the setting for start_precmd should probably be something else,
but i never bothered to cons up the code to do the "right thing"
there, since i didn't need it.

making rc.subr use $sshd_command instead of $command seems trivial
enough, until you start looking at all the other things people might
like to tweak.  the next step would be to provide overrides of those
(eg, required_files, start_precmd, and extra_commands above).  one
might later consider arguing that rc.subr could check for a value in
the variable named ${name}_command and stuff the value from that into
$command before continuing (etc)...but even that grows quickly out of
hand.  using /etc/rc.conf.d for this works now, and has for a long
time (afaict).

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."