From owner-freebsd-arch Wed Apr 10 2:15:26 2002 Delivered-To: freebsd-arch@freebsd.org Received: from infinitive.futureperfectcorporation.com (infinitive.futureperfectcorporation.com [196.25.137.68]) by hub.freebsd.org (Postfix) with SMTP id D5BA637B41B for ; Wed, 10 Apr 2002 02:15:18 -0700 (PDT) Received: (qmail 66615 invoked by uid 0); 10 Apr 2002 09:15:15 -0000 Received: from unknown (HELO gerund.futureperfectcorporation.com) (196.25.137.65) by infinitive.futureperfectcorporation.com with DES-CBC3-SHA encrypted SMTP; 10 Apr 2002 09:15:14 -0000 Received: (qmail 48075 invoked by uid 1001); 10 Apr 2002 09:17:03 -0000 Date: Wed, 10 Apr 2002 11:17:03 +0200 From: Neil Blakey-Milner To: Luigi Rizzo Cc: Nik Clayton , Nate Williams , arch@FreeBSD.ORG Subject: non-variables in rc.conf (Re: proposed code: automatic setting of hostname from MAC address) Message-ID: <20020410091703.GA47576@mithrandr.moria.org> References: <20020407035941.B37911@iguana.icir.org> <15538.12905.744914.71228@caddis.yogotech.com> <20020408235226.B57765@iguana.icir.org> <20020409203403.U30474@canyon.nothing-going-on.org> <20020409225148.A68389@iguana.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020409225148.A68389@iguana.icir.org> User-Agent: Mutt/1.3.27i Organization: iTouch Labs X-Operating-System: FreeBSD 4.3-RELEASE i386 X-URL: http://mithrandr.moria.org/nbm/ Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue 2002-04-09 (22:51), Luigi Rizzo wrote: > On Tue, Apr 09, 2002 at 08:34:03PM +0100, Nik Clayton wrote: > ... > > > The call to auto_set_hostname() in rc.conf will fetch the MAC address > > > from the first ethernet card, look it up in a database of > > > MAC<->hostname pairs (/etc/ethers, or /etc/hosts), and sets the > > > "hostname" and "ifconfig_foo0" shell variables accordingly. From > > > there on, rc.conf is absolutely the same as usual. > > > > Why not do this in /etc/rc.conf.local, which can be local to each > > machine, with /etc/rc.conf being sitewide? > > rc.conf can be local as well. My whole point is try to have > a single config file as opposed to 100 of them! Maybe I'm being silly, but I was hoping the whole rc.conf system could move from being "sh" and become just variables in preparation for some as-yet-undefined changes to configuration that may be required in future. In fact, I wrote the first step to do this and posted it a while back (can't find it at the moment. The file name was rc.sourceconf or something). This move would make sysinstall and potential future configuration tools much easier to maintain and write, since the entire "rc configuration" can be handled by a C library (these exist already, iirc). The alternative is to make the configuration tool include sh's functionality, or call it externally. Future changes (the as-yet-undefined bit) might be per-hostname/ip configuration at around 6.0 era (or even 5.0, but I'm not in a hurry). Abstracting the configuration away from "shell scripts and functions" would allow us to pull the configuration in from other locations in the "backend". The one basic example I did perform was in the order of (replace \ns with real enters): eval `echo 'g/^[:space:]*$/d\ng/^#/d\ng/$/s//;/\ng/./' | ed -s \!'cat /etc/rc.alternate.conf'` Anyway, assume that we can get our network configured beforehand, and we can then use ldap, NIS, or whatever (netinfo?) to get our configuration. In Luigi's case, he would write a new backend that does some magic to set (or overwrite) variables based on hostname or ip. Something that grabs all variables prefixed with the hostname, and removes the prefix, and then sets the variables. It could even be written in C. Or maybe I'm thinking in entirely the wrong direction? Neil -- Neil Blakey-Milner nbm@mithrandr.moria.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message