Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / etc / namedb / make-localhost
CommitLineData
984263bc
MD
1#!/bin/sh
2#
3# $FreeBSD: src/etc/namedb/make-localhost,v 1.4.2.2 2002/02/04 18:24:21 ume Exp $
1de703da 4# $DragonFly: src/etc/namedb/make-localhost,v 1.2 2003/06/17 04:24:48 dillon Exp $
984263bc
MD
5#
6# make-localhost - edit the appropriate local information into
7# /etc/namedb/localhost.rev
8#
9
10PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
11export PATH
12
13if [ "`hostname -s`" != "`hostname`" ]; then
14 # hostname must contain domain
15
16 host=`hostname -s`
17 fullhost=`hostname`
18 domain=`echo $fullhost | sed "s/^$host\.//"`
19else
20 host=`hostname`
21
22 if [ -z "$1" ]; then
23 echo -n 'Enter your domain name: '
24 read domain
25 else
26 domain="$1"
27 fi
28
29 # strip trailing dot, if any
30 domain=`echo $domain | sed 's/\.$//'`
31 fullhost="$host.$domain"
32fi
33
34date=`date +"%Y%m%d"`
35
36mv -f localhost-v6.rev localhost-v6.rev.BAK 2>/dev/null
37
38sed -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
42
43mv -f localhost.rev localhost.rev.BAK 2>/dev/null
44
45exec sed -e "s/@host@/$fullhost/g" \
46 -e "s/@domain@/$domain/g" \
47 -e "s/@date@/$date/g" \
48 < PROTO.localhost.rev > localhost.rev