Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Mar 1999 09:28:29 -0500 (EST)
From:      John Baldwin <jobaldwi@vt.edu>
To:        "Daniel C. Sobral" <dcs@newsguy.com>
Cc:        current@FreeBSD.ORG, "Jordan K. Hubbard" <jkh@zippy.cdrom.com>, Richard Wackerbarth <rkw@dataplex.net>, John Baldwin <jobaldwi@vt.edu>
Subject:   Re: /etc/rc.conf, take 46!
Message-ID:  <XFMail.990322092829.jobaldwi@vt.edu>
In-Reply-To: <36F64C3D.9369B963@newsguy.com>

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

On 22-Mar-99 Daniel C. Sobral wrote:
> John Baldwin wrote:
>> 
>> However, the original definition has already been used once the /etc/rc.conf
>> has been read.  Unless you are going to call the for loop twice, once after
>> /etc/defaults/rc.conf to include /etc/rc.conf and once after /etc/rc.conf to
>> include the extra stuff you define, your changes to ${rc_conf_files} in
>> /etc/rc.conf will never take effect.
> 
> Make a sucking function (or separate script), call it recursively
> for each time rc_conf_files change.
> 
>#!/bin/sh
> for file in $1
> do
>    . $file
>    if [ "${rc_conf_files}X" != "$*X" ] then
>       . $0 "${rc_conf_files}"
>    fi
> done

I would move the if-statemeount outside the for loop. Say config file a defines
rc_conf_files="b c", and config file b defines rc_conf_files="d".  a is
executed and then b is sucked in, rc_conf_files has changed, so the function
calls itself to read in config file "d".  Then the recursive call returns and
"c" is read.  Thus, the files would be read in the order a, b, d, c and "c"
could possibly override customizations the user had put in d.  To me the
logical order for the files to be read in would be a, b, c, d.  Moving the
if-statement outside of the for loop would give the latter behavior.  Other
than that it works for me.

> --
> Daniel C. Sobral                      (8-DCS)
> dcs@newsguy.com
> dcs@freebsd.org
> 
>       "What happened?"
>       "It moved, sir!"

---

John Baldwin <jobaldwi@vt.edu> -- http://members.freedomnet.com/~jbaldwin/
PGP Key: http://members.freedomnet.com/~jbaldwin/pgpkey.asc



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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