1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00
freebsd/etc/namedb/make-localhost
Doug Barton 8f1bb3891d Create a named chroot directory structure in /var/named, and use it
by default when named is enabled. Also, improve our default directory
layout by creating /var/named/etc/namedb/{master|slave} directories,
and use the former for the generated localhost* files.

Rather than using pax to copy device entries, mount devfs in the
chroot directory.

There may be some corner cases where things need to be adjusted,
but overall this structure has been well tested on a production
network, and should serve the needs of the vast majority of users.

UPDATING has instructions on how to do the conversion for those
with existing configurations.
2004-09-28 09:46:00 +00:00

50 lines
1021 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# make-localhost - edit the appropriate local information into
# /etc/namedb/localhost.rev
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
export PATH
if [ "`hostname -s`" != "`hostname`" ]; then
# hostname must contain domain
host=`hostname -s`
fullhost=`hostname`
domain=`echo $fullhost | sed "s/^$host\.//"`
else
host=`hostname`
if [ -z "$1" ]; then
echo -n 'Enter your domain name: '
read domain
else
domain="$1"
fi
# strip trailing dot, if any
domain=`echo $domain | sed 's/\.$//'`
fullhost="$host.$domain"
fi
date=`date +"%Y%m%d"`
mkdir -p master
mv -f master/localhost-v6.rev master/localhost-v6.rev.BAK 2>/dev/null
sed -e "s/@host@/$fullhost/g" \
-e "s/@domain@/$domain/g" \
-e "s/@date@/$date/g" \
< PROTO.localhost-v6.rev > master/localhost-v6.rev
mv -f master/localhost.rev master/localhost.rev.BAK 2>/dev/null
exec sed -e "s/@host@/$fullhost/g" \
-e "s/@domain@/$domain/g" \
-e "s/@date@/$date/g" \
< PROTO.localhost.rev > master/localhost.rev