Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Nov 1999 18:17:33 +0900 (JST)
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        jkh@freebsd.org
Cc:        freebsd-arch@freebsd.org
Subject:   rc.conf
Message-ID:  <199911280917.SAA00334@daniel.sobral>

next in thread | raw e-mail | index | archive | help
[on an afterthough, I decided to cc this to -arch -- it concerns
a library that handles reading/modification of rc.conf-like files]


I'm thinking about the library. Right now, I have a readconf() function
that the application must use for each file (as per the libconf.h I sent
you :), and the app must provide the logic for multiple files itself. Ie,
if it must read /etc/defaults/rc.conf first, and then read the files in
one of it's variables in turn, the app should know that itself.

So I was thinking in providing a readrcconf() and readloaderconf()
functions that would have this logic builtin. On the plus side, if
we change the logic, we don't need to change any other application,
just the library (well, and all other script-type applications that
source it :( ). On the negative side, if we changed the logic, and
the person made world but not updated /etc, the library would be
working with the new logic and the rc files would be working with
the old one, with possible adverse effects.

That's one thing, and it led me to consider another thing. Right now,
the logic for reading rc.conf files is inside /etc/defaults/rc.conf,
with some of it on each script sourcing it to allow for no
/etc/defaults/rc.conf (we should remove this allowance now in 4.0, just
like phk is removing all legacy garbage, btw). I was thinking in writing
a small script containing that logic. Eg:

#!/bin/sh
if [ x$1 == xv ]; then
	echo /etc/defaults/rc.conf
fi
. /etc/defaults/rc.conf
for i in ${rc_conf_files}; do
        if [ -f $i ]; then
	if [ x$1 == xv ]; then
		echo $i
	fi
                . $i
        fi
done

So instead of . /etc/defaults/rc.conf, one would do . /etc/sourcercconf
instead. Also, applications that need to do their own sourcing could
exec /etc/sourcercconf -v, and get the list of files they need to source.

Any change in the logic would be restricted to that. How's that?

-- 
Daniel C. Sobral		  (8-DCS)
dcs@newsguy.com
dcs@freebsd.org

Udall's Fourth Law:
	Any change or reform you make
	is going to have consequences you don't like.




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




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