Date: Fri, 23 Feb 2007 00:56:44 -0600 From: Brooks Davis <brooks@freebsd.org> To: Vasil Dimov <vd@freebsd.org> Cc: Brooks Davis <brooks@freebsd.org>, freebsd-rc@freebsd.org Subject: Re: Setting rc scripts default values Message-ID: <20070223065644.GA94159@lor.one-eyed-alien.net> In-Reply-To: <20070223063428.GA96292@qlovarnika.bg.datamax> References: <20070222172658.GA40593@qlovarnika.bg.datamax> <20070222222526.GA90840@lor.one-eyed-alien.net> <20070223063428.GA96292@qlovarnika.bg.datamax>
next in thread | previous in thread | raw e-mail | index | archive | help
--n8g4imXOkfNTN/H1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 23, 2007 at 08:34:28AM +0200, Vasil Dimov wrote: > 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, > > >=20 > > > Is there any special reason to write the rc scripts this way: > > >=20 > > > load_rc_config "$name" > > > : ${rsyncd_enable=3D"NO"} > > >=20 > > > instead of this way: > > >=20 > > > rsyncd_enable=3D"NO" > > > load_rc_config "$name" > > >=20 > > > apache does it this way: > > >=20 > > > apache_enable=3D${apache_enable-"NO"} > > > load_rc_config $name > > >=20 > > > but I think it can safely be changed to > > >=20 > > > apache_enable=3D"NO" > > > load_rc_config $name > > >=20 > > > What did I miss... > >=20 > > load_rc_config doesn't reread /etc/rc.conf every time. >=20 > 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]. >=20 > Can you show me a scenario where this code: >=20 > . /etc/rc.subr > rcvar=3D`set_rcvar` > foo_enable=3D"NO" > load_rc_config ${name} # foo_enable=3D"YES" is in /etc/rc.conf >=20 > ends up with foo_enable=3D"NO"? >=20 > Thanks. load_rc_config is called from /etc/rc before any scripts are run on startup. If that doesn't result in _rc_conf_loaded being set in the script, the code is useless and should be ripped out (I'm not entierly sure it isn't useless, but it's late here and I'm not going to test it now). -- Brooks --n8g4imXOkfNTN/H1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFF3pArXY6L6fI4GtQRAtXdAKCLsr+/admCKTBVmKDkM0cUMb7A0gCfTARs Ca1kkhbYPo/f8MSHjJdsaGg= =YgOs -----END PGP SIGNATURE----- --n8g4imXOkfNTN/H1--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070223065644.GA94159>