Skip site navigation (1)Skip section navigation (2)
Date:      13 Oct 2001 16:23:12 +0200
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        Doug Barton <DougB@DougBarton.net>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: Strike three, you're out
Message-ID:  <xzp4rp3ippr.fsf@flood.ping.uio.no>
In-Reply-To: <xzp8zefiqhz.fsf@flood.ping.uio.no>
References:  <3BC67CBD.1DAAC031@DougBarton.net> <xzpr8s9av9n.fsf@flood.ping.uio.no> <3BC7EA21.15F43811@DougBarton.net> <xzp8zefiqhz.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
Dag-Erling Smorgrav <des@ofug.org> writes:
> I'm wondering if actually the correct solution might be to have
> /etc/rc generate host.conf at boot time from the contents of
> nsswitch.conf.  I'll see if I can cook up an awk script to do that.

This seems to do the trick:

/usr/bin/awk '
BEGIN {
    xlat["files"] = "hosts";
    xlat["dns"] = "bind";
    xlat["nis"] = "nis";
}
/^hosts:/ {
    print "# Auto-generated, do not edit";
    for (n = 2; n <= NF; ++n)
        if ($n in xlat)
            print xlat[$n];
    quit;
}
// {
    next;
}
' /etc/nsswitch.conf >/etc/host.conf

DES
-- 
Dag-Erling Smorgrav - des@ofug.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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