summaryrefslogtreecommitdiffstats
path: root/etc/namedb/make-localhost
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-03-21 16:33:45 +0000
committerwollman <wollman@FreeBSD.org>1995-03-21 16:33:45 +0000
commit7f0f8722f6f4b445242f230675dabb9e105df3ca (patch)
tree51ce5e1aa960575b05779431883814e336f9ab7b /etc/namedb/make-localhost
parent976a4f67ae008839e122c53d31472ce88ec98a17 (diff)
downloadFreeBSD-src-7f0f8722f6f4b445242f230675dabb9e105df3ca.zip
FreeBSD-src-7f0f8722f6f4b445242f230675dabb9e105df3ca.tar.gz
Update root NS cache.
Delete bogus localhost.rev. Add prototype localhost.rev and a script to create it automatically. (NB to installl people: you should ask ``do you have a full-time connection o the Internet?'', run this script, and enable named if the answer is yes.)
Diffstat (limited to 'etc/namedb/make-localhost')
-rwxr-xr-xetc/namedb/make-localhost35
1 files changed, 35 insertions, 0 deletions
diff --git a/etc/namedb/make-localhost b/etc/namedb/make-localhost
new file mode 100755
index 0000000..e321da6
--- /dev/null
+++ b/etc/namedb/make-localhost
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# make-localhost - edit the appropriate local information into
+# /etc/namedb/localhost.rev
+#
+
+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
OpenPOWER on IntegriCloud