view scripts/nameserver_autogen/tinydns_tld_datafile @ 1234:538446cd9d41 draft

Revert "dropped the use of @ so the generated zones would work with yadifa too. also exported env vars so child of bind_tld_zonefile_all.sh can use them" This reverts commit ab834161696a4f9150d1c8f52bb6f0f453950cb7.
author epoch <epoch@hack.thebackupbox.net>
date Wed, 10 Jul 2019 01:12:59 +0000
parents dab670ad6e31
children
line wrap: on
line source

#!/bin/sh
if ! ./scripts/check_db_safety; then
 exit 1
fi
tldsrvrname="$(./scripts/conf_var tinydns__tldsrvrname uz5fvb7zdqyuz4q8ysjdfuf04kzd2lrt0l6fp4uyguxdg5tfut06ck.anons.somerandomnick.ano)"
tldsrvrip="$(./scripts/conf_var tinydns__tldsrvrip 1.0.27.37)"
echo "+$tldsrvrname:$tldsrvrip:3600"
for tld in db/ip/?? ; do
 if [ "x$(basename $tld)" != 'x??' ]; then
  first="$(basename $tld | ./scripts/hex2dec)"
  tldname="$first.in-addr.arpa"
  echo ".$tldname::$tldsrvrname"
  for ip in $tld/??/?? ; do
   if [ "x$(basename $ip)" != 'x??' ]; then
    third="$(basename $ip | ./scripts/hex2dec)"
    second="$(basename $(dirname $ip) | ./scripts/hex2dec)"
    first="$(basename $(dirname $(dirname $ip)) | ./scripts/hex2dec)"
    domain="$third.$second.$first.in-addr.arpa"
    for ns in $ip/ns/* ; do
     nsname="$(basename $ns)"
     if [ "x$nsname" != 'x*' ]; then
      nsip="$(cat $ns)"
      echo "&$domain:$nsip:$nsname"
     fi
    done
   fi
  done
 fi
done
for tld in db/dom/* ; do
 tldname="$(basename $tld)"
 echo ".$tldname::$tldsrvrname"
 for zone in $tld/* ; do
  for ns in $zone/ns/* ; do
   domain="$(basename $zone).$(basename $tld)"
   nsip="$(cat $ns)"
   nsname="$(basename $ns)"
   echo "&$domain:$nsip:$nsname"
  done
 done
done