changeset 1190:dae39c508416 draft

updated the bind_tld_zonefile_all.sh for 21.0.0.0/8
author epoch <epoch@hacking.allowed.ano>
date Thu, 09 Mar 2017 23:58:05 +0000
parents 7a618eaa29cb
children 56c959ab3e05
files scripts/nameserver_autogen/bind_tld_zonefile_all.sh
diffstat 1 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/nameserver_autogen/bind_tld_zonefile_all.sh	Thu Mar 09 23:48:00 2017 +0000
+++ b/scripts/nameserver_autogen/bind_tld_zonefile_all.sh	Thu Mar 09 23:58:05 2017 +0000
@@ -2,11 +2,8 @@
 #made for bash. not sure if all /bin/sh work.
 #be sure to edit these variables first.
 
-#zonefiles are named after the TLD they're for.
-#make sure not to clobber any files. ;)
-
 #ZONEFILE_DIR=/etc/namedb
-#RDNS_ZONEFILE=/etc/namedb/1.in-addr.arpa
+RDNS_ZONEFILE=/etc/namedb/21.in-addr.arpa
 #RESDB_PATH=/var/db/resdb
 
 if [ ! "$ZONEFILE_DIR" ];then
@@ -15,7 +12,7 @@
 fi
 
 
-echo -n "generating ipv4 reverse lookup zonefile for 1/8..."
+echo -n "generating ipv4 reverse lookup zonefile for 21/8..."
 
 echo "; this zonefile genreated on: `date`" > "$RDNS_ZONEFILE"
 echo '$TTL 3600' >> "$RDNS_ZONEFILE"
@@ -23,7 +20,7 @@
 echo '@ IN NS @' >> "$RDNS_ZONEFILE"
 echo '@ IN A 127.0.0.1' >> "$RDNS_ZONEFILE"
 
-for i in `ls ${RESDB_PATH}/db/ip/01/*/*/ns/*`;do
+for i in `ls ${RESDB_PATH}/db/ip/15/*/*/ns/*`;do #this is for 21.
  f=$(basename $i)
  a=$(basename $(dirname $i))
  b=$(basename $(dirname $(dirname $i)))
@@ -55,11 +52,11 @@
     fi
     fqserver=`cut -d/ -f3- <<< $server`
     echo -e "${name}\tIN NS\t${fqserver}."
-    for ip in `cat ${server}`;do 
+    for ip in $(cat ${server});do 
      if grep ':' <<< "$ip" > /dev/null;then
-      echo -e "${fqserver}.\tIN AAAA\t$ip"
+      printf '%s.\tIN AAAA\t%s\n' "${fqserver}" "${ip}"
      else
-      echo -e "${fqserver}.\tIN A\t$ip"
+      printf '%s.\tIN A\t%s\n' "${fqserver}" "${ip}"
      fi
     done
    done