# HG changeset patch # User epoch # Date 1369631761 0 # Node ID 8e01b8361e9e18d9dd3fe1d9e94b5f1542984f04 # Parent 5645d1ed79c525002b0a5b48ef1ad5c4abb6ae02 changed add_dom to not even bother with anything head -c -1 related. should still work. added a comment at the top of dec2hex to suggest a shorter version that should work. added a script for generating zonefiles for bind diff -r 5645d1ed79c5 -r 8e01b8361e9e scripts/add_dom --- a/scripts/add_dom Fri May 24 02:39:47 2013 +0000 +++ b/scripts/add_dom Mon May 27 05:16:01 2013 +0000 @@ -4,15 +4,15 @@ echo "Usage: $0 [...]" >&2; exit 255 fi -dir=db/dom/"$(echo "$1" | tr . '\n' | tac | tr '\n' / | ./scripts/head_-c_-1)" +dir=db/dom/"$(echo "$1" | tr . '\n' | tac | tr '\n' / )" mkdir -p "$dir" || exit 1 -echo "$2" > "$dir/owner" -mkdir "$dir/ns" || exit 1 +echo "$2" > "${dir}owner" +mkdir "${dir}ns" || exit 1 shift; shift; while [ x"$1" != x ]; do echo "$1" | tr / ' ' | ( read ns nsip - echo "$nsip" > "$dir/ns/$ns" + echo "$nsip" > "${dir}ns/$ns" ) shift; done diff -r 5645d1ed79c5 -r 8e01b8361e9e scripts/dec2hex --- a/scripts/dec2hex Fri May 24 02:39:47 2013 +0000 +++ b/scripts/dec2hex Mon May 27 05:16:01 2013 +0000 @@ -1,4 +1,5 @@ #!/bin/sh +# maybe use? not sure if this would break anything. : printf "%02X" $1 ( if [ x"$USE_BC" = x1 ]; then echo -n "obase=16; " diff -r 5645d1ed79c5 -r 8e01b8361e9e scripts/nameserver_autogen/bind_tld_zonefile.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/nameserver_autogen/bind_tld_zonefile.sh Mon May 27 05:16:01 2013 +0000 @@ -0,0 +1,35 @@ +#!/bin/bash +#made for bash. not sure if all /bin/sh work. +#be sure to edit these variables first. + +ANO_ZONEFILE=/etc/namedb/ano +RESDB_PATH=/services/resdb/resdb + +echo "; this zonefile genreated on: `date`" > $ANO_ZONEFILE +echo '$TTL 3600' >> $ANO_ZONEFILE +echo '@ IN SOA localns root ('`date +" %Y%m%d00"`' 60 300 3600000 3600 )' >> $ANO_ZONEFILE +echo '@ IN NS localns' >> $ANO_ZONEFILE +echo 'localns IN A 127.0.0.1' >> $ANO_ZONEFILE + +cd ${RESDB_PATH}/db/dom/ano + +echo -n generating zonefile... +for name in *;do + if [ -e "${name}/ns/" ];then + for server in "$name"/ns/*;do + if grep '\.ano$' <<< $name > /dev/null;then + true + fi + if grep '\.ano$' <<< $server > /dev/null;then + true + fi + fqserver=`cut -d/ -f3- <<< $server` + echo -e "${name}\tIN NS\t${fqserver}." + for ip in `cat ${server}`;do + echo -e "${fqserver}.\tIN A\t$ip" + done + done + fi +done >> $ANO_ZONEFILE +echo done. +echo might want to send a sighup to your named now.