Testing commits.
[dragonfly.git] / etc / namedb / make-localhost
blob23e2f8407ccbf7b7e4e579aab00da8769b4a4939
1 #!/bin/sh
3 # $FreeBSD: src/etc/namedb/make-localhost,v 1.4.2.2 2002/02/04 18:24:21 ume Exp $
4 # $DragonFly: src/etc/namedb/make-localhost,v 1.2 2003/06/17 04:24:48 dillon Exp $
6 # make-localhost - edit the appropriate local information into
7 # /etc/namedb/localhost.rev
10 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
11 export PATH
13 if [ "`hostname -s`" != "`hostname`" ]; then
14 # hostname must contain domain
16 host=`hostname -s`
17 fullhost=`hostname`
18 domain=`echo $fullhost | sed "s/^$host\.//"`
19 else
20 host=`hostname`
22 if [ -z "$1" ]; then
23 echo -n 'Enter your domain name: '
24 read domain
25 else
26 domain="$1"
29 # strip trailing dot, if any
30 domain=`echo $domain | sed 's/\.$//'`
31 fullhost="$host.$domain"
34 date=`date +"%Y%m%d"`
36 mv -f localhost-v6.rev localhost-v6.rev.BAK 2>/dev/null
38 sed -e "s/@host@/$fullhost/g" \
39 -e "s/@domain@/$domain/g" \
40 -e "s/@date@/$date/g" \
41 < PROTO.localhost-v6.rev > localhost-v6.rev
43 mv -f localhost.rev localhost.rev.BAK 2>/dev/null
45 exec sed -e "s/@host@/$fullhost/g" \
46 -e "s/@domain@/$domain/g" \
47 -e "s/@date@/$date/g" \
48 < PROTO.localhost.rev > localhost.rev