Date: Fri, 3 Jan 2003 10:41:08 +0200 From: Neil Blakey-Milner <nbm@mithrandr.moria.org> To: Jordan K Hubbard <jkh@queasyweasel.com> Cc: Terry Lambert <tlambert2@mindspring.com>, wgrim@siue.edu, phk@FreeBSD.ORG, kientzle@acm.org, freebsd-hackers@FreeBSD.ORG Subject: Re: Reading rc.conf from C programs? Message-ID: <20030103084108.GB61889@mithrandr.moria.org> In-Reply-To: <8183059A-1E9C-11D7-883C-000393BB9222@queasyweasel.com> References: <3E14B087.EC43701B@mindspring.com> <8183059A-1E9C-11D7-883C-000393BB9222@queasyweasel.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu 2003-01-02 (13:52), Jordan K Hubbard wrote: > In hindsight, if we'd really wanted a key/value pair database then we > should have done it in XML and simply dealt with it at arm's length > through a accessor utility, e.g. instead of: > > case ${ipsec_enable} in > > We'd have: > > case `sysconfig -r ipsec_enable` in > > Or something to that effect. > > If you're really looking for "the real solution" underlying this > problem then you need to look past the format being used at the moment > and at the fundamental problem it was originally trying to solve. Hi Jordan, I'd probably rather have a program to export the whole configuration into the environment, but obviously this does mean there's no dynamic query. Dynamic query might be nice, since it would start using, for example, network configuration once it is available. I've proposed before that we have an sh script that can be sourced and it'll magically do whatever is necessary to put the configuration into the environment - ideally there'd be a C library that'd do the same. Although it's ugly to look at (since 'ed' is the only text manipulation available), I show in http://docs.freebsd.org/cgi/getmsg.cgi?fetch=68185+0+archive/2002/freebsd-arch/20020414.freebsd-arch how we can take the output of any given command ("backend") that is in the 'foo="blah"' format and export it into the shell environment. So, if we had a "/etc/rc.backend" that is either symlinked to or executes the backend (say, "sysconfig -a"), then we can dynamically generate the configuration from over the network (assuming we've managed to get that set up) using LDAP or netinfo. Possibly, libsysconfig would provide the same functionality for C programs, similar to PAM or nsswitch. Actually, for me it doesn't matter, so long as we actually get over the hurdle of not being able to read/edit the configuration automatically. If we'd done it when I originally suggested it in 2000, we'd have tons of excellent tools like thefish already. Neil -- Neil Blakey-Milner nbm@mithrandr.moria.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030103084108.GB61889>