Automatic per-site configuration
Kevin Oberman
kob6558 at gmail.com
Sun Jun 26 18:10:24 UTC 2011
On Sun, Jun 26, 2011 at 1:55 AM, Paul Schenkeveld <freebsd at psconsult.nl> wrote:
> Hi,
>
> There must be many others like me who carry a laptop from one site to
> another every week. Currently I have to work at four different sites.
>
> I'd like my FreeBSD 8.2 laptop to automatically start stuff depending
> on where I boot it and also my personal login environment depends on
> where I am (PRINTER setting in .profile, clients to automatically start
> and DISPLAY setting in .xsession, key bindings in .ctwmrc etc.)
>
> Until recently I could look at the fully qualified hostname I got from
> DHCP as all DHCP servers gave me a usable hostname but now I also have
> to work at various sites where DHCP does not give me a hostname at all.
>
> Getting no hostname from DHCP confuses xdm which defaults to "1"
> requiring me to switch to another virtual console and manually set the
> hostname to "localhost" or something.
>
> The hostname="foo.bar.tld" in rc.conf is absolute, when set the hostname
> obtained from DHCP is ignored.
>
> How do other people solve this? I'd prefer to to be prompted during
> boot and during login for the site I want to configure for.
I have been using Tobias Roth's profile to do this for several years.
It is an RC script that runs right after mountcritical and checks for
known networks via several techniques. It then does a unionfs mount of
a file-backed md on /etc. It contains t least a locations specific
rc.conf.local and my contain whatever other files in /etc which you
might want per-site, such as resolv.conf or wpa_supplicant.conf.
While it has worked (with a two line tweak to /etc/rc.subr to rollback
the for support for special processing of rc.d files with a .sh
extension), several developers expressed concerns with its viability
and I don't think Tobias has done anything with it for some time. I'm
not even sure that it is still available. If it is not, I could
probably make it, along with the trivial patch to /etc/rc.subr
available.
For a tool that supposedly would suffer from long-term viability, I
have been using it for FreeBSD 5 through 8. I suspect it will work
fine in 9, when I get around to trying it.
--
R. Kevin Oberman, Network Engineer - Retired
E-mail: kob6558 at gmail.com
More information about the freebsd-mobile
mailing list