From owner-freebsd-hackers Fri Jan 3 0:37:23 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1CC2137B401 for ; Fri, 3 Jan 2003 00:37:22 -0800 (PST) Received: from infinitive.futureperfectcorporation.com (infinitive.futureperfectcorporation.com [196.25.137.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4559543ED8 for ; Fri, 3 Jan 2003 00:37:19 -0800 (PST) (envelope-from nbm@gerund.futureperfectcorporation.com) Received: (qmail 61665 invoked by uid 0); 3 Jan 2003 08:37:16 -0000 Received: from gerund.futureperfectcorporation.com (196.25.137.65) by infinitive.futureperfectcorporation.com with DES-CBC3-SHA encrypted SMTP; 3 Jan 2003 08:37:16 -0000 Received: (qmail 62403 invoked by uid 1001); 3 Jan 2003 08:41:08 -0000 Date: Fri, 3 Jan 2003 10:41:08 +0200 From: Neil Blakey-Milner To: Jordan K Hubbard Cc: Terry Lambert , 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> References: <3E14B087.EC43701B@mindspring.com> <8183059A-1E9C-11D7-883C-000393BB9222@queasyweasel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8183059A-1E9C-11D7-883C-000393BB9222@queasyweasel.com> User-Agent: Mutt/1.3.27i Organization: iTouch Technology and Architectural Services X-Operating-System: FreeBSD 4.3-RELEASE i386 X-URL: http://mithrandr.moria.org/nbm/ Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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