mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
9766e32c01
work right when the administrator has modified their runtime environment in a manner not anticipated by our script. Requested by: Tom Maher <tardis@ece.cmu.edu>
41 lines
773 B
Bash
Executable File
41 lines
773 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"`
|
|
|
|
mv -f localhost.rev 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 > localhost.rev
|