Home | History | Annotate | Line # | Download | only in ns2
      1 #!/bin/sh -e
      2 
      3 # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      4 #
      5 # SPDX-License-Identifier: MPL-2.0
      6 #
      7 # This Source Code Form is subject to the terms of the Mozilla Public
      8 # License, v. 2.0.  If a copy of the MPL was not distributed with this
      9 # file, you can obtain one at https://mozilla.org/MPL/2.0/.
     10 #
     11 # See the COPYRIGHT file distributed with this work for additional
     12 # information regarding copyright ownership.
     13 
     14 # shellcheck source=conf.sh
     15 . ../../conf.sh
     16 
     17 echo_i "ns2/setup.sh"
     18 
     19 cp template.db.in tld0.db
     20 echo "final.tld0. IN NS ns.final.tld0." >>tld0.db
     21 echo "ns.final.tld0. IN A 10.53.0.3" >>tld0.db
     22 
     23 DEPTH=5
     24 
     25 tld=1
     26 while [ $tld -le $DEPTH ]; do
     27 
     28   cat >>"named.conf" <<EOF
     29 zone "tld${tld}" {
     30         type primary;
     31         file "tld${tld}.db";
     32 };
     33 EOF
     34 
     35   cp template.db.in tld${tld}.db
     36 
     37   label=0
     38   while [ $label -le $DEPTH ]; do
     39     echo "label${label}.tld${tld}. IN NS ns.label${label}.tld${tld}." >>tld${tld}.db
     40     echo "ns.label${label}.tld${tld}. IN A 10.53.0.3" >>tld${tld}.db
     41     echo "" >>tld${tld}.db
     42 
     43     label=$((label + 1))
     44   done
     45 
     46   tld=$((tld + 1))
     47 done
     48 
     49 goto=1
     50 tld=1
     51 while [ $goto -le $DEPTH ]; do
     52   echo "goto${goto}.tld${tld}. IN NS ns.goto${goto}.tld${tld}." >>tld${tld}.db
     53   echo "ns.goto${goto}.tld${tld}. IN A 10.53.0.3" >>tld${tld}.db
     54   echo "" >>tld${tld}.db
     55 
     56   goto=$((goto + 1))
     57 done
     58