]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/namedb/make-localhost
This commit was generated by cvs2svn to compensate for changes in r164219,
[FreeBSD/FreeBSD.git] / etc / namedb / make-localhost
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5 # make-localhost - edit the appropriate local information into
6 # /etc/namedb/localhost.rev
7 #
8
9 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
10 export PATH
11
12 if [ "`hostname -s`" != "`hostname`" ]; then
13         # hostname must contain domain
14
15         host=`hostname -s`
16         fullhost=`hostname`
17         domain=`echo $fullhost | sed "s/^$host\.//"`
18 else
19         host=`hostname`
20
21         if [ -z "$1" ]; then
22                 echo -n 'Enter your domain name: '
23                 read domain
24         else
25                 domain="$1"
26         fi
27
28         # strip trailing dot, if any
29         domain=`echo $domain | sed 's/\.$//'`
30         fullhost="$host.$domain"
31 fi
32
33 date=`date +"%Y%m%d"`
34
35 mkdir -p master
36
37 mv -f master/localhost-v6.rev master/localhost-v6.rev.BAK 2>/dev/null
38
39 sed -e "s/@host@/$fullhost/g" \
40         -e "s/@domain@/$domain/g" \
41         -e "s/@date@/$date/g" \
42         < PROTO.localhost-v6.rev > master/localhost-v6.rev
43
44 mv -f master/localhost.rev master/localhost.rev.BAK 2>/dev/null
45
46 exec sed -e "s/@host@/$fullhost/g" \
47         -e "s/@domain@/$domain/g" \
48         -e "s/@date@/$date/g" \
49         < PROTO.localhost.rev > master/localhost.rev