Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Apr 2002 11:17:03 +0200
From:      Neil Blakey-Milner <nbm@mithrandr.moria.org>
To:        Luigi Rizzo <rizzo@icir.org>
Cc:        Nik Clayton <nik@FreeBSD.ORG>, Nate Williams <nate@yogotech.com>, 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>
In-Reply-To: <20020409225148.A68389@iguana.icir.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>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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