Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2007 08:34:28 +0200
From:      Vasil Dimov <vd@FreeBSD.org>
To:        Brooks Davis <brooks@freebsd.org>
Cc:        freebsd-rc@freebsd.org
Subject:   Re: Setting rc scripts default values
Message-ID:  <20070223063428.GA96292@qlovarnika.bg.datamax>
In-Reply-To: <20070222222526.GA90840@lor.one-eyed-alien.net>
References:  <20070222172658.GA40593@qlovarnika.bg.datamax> <20070222222526.GA90840@lor.one-eyed-alien.net>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Thu, Feb 22, 2007 at 16:25:26 -0600, Brooks Davis wrote:
> On Thu, Feb 22, 2007 at 07:26:58PM +0200, Vasil Dimov wrote:
> > Hi,
> > 
> > Is there any special reason to write the rc scripts this way:
> > 
> > load_rc_config "$name"
> > : ${rsyncd_enable="NO"}
> > 
> > instead of this way:
> > 
> > rsyncd_enable="NO"
> > load_rc_config "$name"
> > 
> > apache does it this way:
> > 
> > apache_enable=${apache_enable-"NO"}
> > load_rc_config $name
> > 
> > but I think it can safely be changed to
> > 
> > apache_enable="NO"
> > load_rc_config $name
> > 
> > What did I miss...
> 
> load_rc_config doesn't reread /etc/rc.conf every time.

Hmmz, I see that load_rc_config() does not reread /etc/rc.conf only if
_rc_conf_loaded is set. The only place where _rc_conf_loaded is set is
in load_rc_config() itself after it reads /etc/rc.conf. load_rc_config()
is not called anywhere in rc.subr [1].

Can you show me a scenario where this code:

. /etc/rc.subr
rcvar=`set_rcvar`
foo_enable="NO"
load_rc_config ${name}  # foo_enable="YES" is in /etc/rc.conf

ends up with foo_enable="NO"?

Thanks.

[1] actually it is called from load_rc_config_var() but in a subshell.

-- 
Vasil Dimov
gro.DSBeerF@dv
%
Testing can show the presense of bugs, but not their absence.
                -- Edsger W. Dijkstra

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----

iD8DBQFF3or0Fw6SP/bBpCARAtmGAKDh4iwuKYlcXYQqwAL4rbzwZKcvHgCdGw/y
POzlu2q3pDsW4D2W8zSwWi4=
=LbQZ
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070223063428.GA96292>