Making use of set_rcvar.

Stefan Esser se at freebsd.org
Mon Jan 9 09:54:02 UTC 2012


Am 09.01.2012 00:12, schrieb Doug Barton:
> Attached is a patch that does what I suggested a long time ago, removes
> set_rcvar() entirely and assigns each rcvar statically. I'll commit this
> in a few days if no one objects. (Note, it can't be committed yet
> because the scripts in ports that call set_rcvar() have to be modified
> first.)
[...]
> Index: rc.d/nscd
> ===================================================================
> --- rc.d/nscd	(revision 229825)
> +++ rc.d/nscd	(working copy)
> @@ -19,7 +19,7 @@
>  . /etc/rc.subr
>
>  name="nscd"
> -rcvar=`set_rcvar`
> +rcvar="nscd_enable"

Why not generally use

	rcvar="${name}_enable"

instead of (e.g.)

	rcvar="nscd_enable"

in all scripts *in your patch set*, for which the outcome is the same?

All except for sendmail_submit_enable, sendmail_outbound_enable,
nfs_server_enable, moused_${2}_enable and clear_tmp_enable.

But for nfsd vs. nfs_server and cleartmp vs. clear_tmp it might be a
good idea to modify $name to match the value of the _enable parameter,
anyway.
Then only the special cases sendmail_*_enable and moused_*_enable would
persist.

The use of "${name}_enable" does not add measurable overhead, but that
way more of an existing script might be used as a prototype unchanged.

But using ${name}_enable enforces the use of an enable parameter that
actually is based on $name, not a slight variation thereof (ISTR such
cases existed and had to be fixed to avoid confusion).

Regards, STefan


More information about the freebsd-rc mailing list