#!/bin/sh

SERVER=a.root-servers.net
TMPFILE=/tmp/tmp.$$
ROOTFILE=./db.root

date=`date`
cat >$ROOTFILE <<EOT
;
;   db.root -- BIND "hint" file
;   [automatically created on $date by db.root.sh]
;
;   Notice: Although this file officially is only used to initially load
;   the cache of the BIND nameserver, it is actually used to specify the
;   root nameservers only.
;

EOT
nslookup >$TMPFILE <<-EOF
server $SERVER
set type=NS
.
EOF
cat $TMPFILE |\
awk '
  /nameserver =/ { printf("%-20s 99999999  IN  NS  %s.\n",   ".", $NF); }
  /address =/    { printf("%-20s 99999999  IN  A   %s\n", $1 ".", $NF); }
' |\
sort >>$ROOTFILE
rm $TMPFILE
echo "" >>$ROOTFILE

