commit e0806d4130026c533ebc1f52d10fe73cd06cc990 Author: Jonah Aragon Date: Sat Mar 23 20:01:47 2019 -0500 Add a simple script diff --git a/db.o b/db.o new file mode 100644 index 0000000..ce3ad08 --- /dev/null +++ b/db.o @@ -0,0 +1,17 @@ +; BIND zone file for o + +$ORIGIN o. +$TTL 1D ; 1 day +@ IN SOA ns11.opennic.glue. jonah.opennic.org. ( + 2019032001 ; serial + 4H ; refresh (4 hours) + 1H ; retry (1 hour) + 1W ; expire (1 week) + 1H ; minimum (1 hour) + ) +; TLD information + IN NS ns11.opennic.glue. + IN NS ns2.opennic.glue. +; +; Additional zones +; diff --git a/update_o.sh b/update_o.sh new file mode 100644 index 0000000..64192de --- /dev/null +++ b/update_o.sh @@ -0,0 +1,40 @@ +#!/bin/bash +#Update script for ".o" on BIND9/Ubuntu 18.04 + +#Variables +CHECKCONF=/usr/sbin/named-checkconf +TMP_DEST='/tmp/db.o' +WORK_DIR='/opt/tld/o/' +FILE_NAME='db.o' +OUTPUT_DIR='/etc/bind/zone/master/o/' +FILES=${WORK_DIR}zone/* + +cd $WORK_DIR +git fetch origin master > /dev/null +git reset --hard origin/master > /dev/null + +for f in $FILES +do + cp $WORK_DIR$FILE_NAME $TMP_DEST + cat $f >> $TMP_DEST + + TEST=$($CHECKCONF "$TMP_DEST") + if [ "$TEST" ]; then + echo "Failed to add ${f}.o to the main zone!" + else + echo "Processed ${f}.o Successfully" + echo ";`git log --oneline -- $f | tail -n 1`" >> $FILE_NAME + cat $f >> $FILE_NAME + fi + + VERIFY=$($CHECKCONF "$WORK_DIR$FILE_NAME") + if [ "$VERIFY" ]; then + echo "Some unknown error occured: $WORK_DIR$FILE_NAME" + exit 1 + fi +done + +rm ${OUTPUT_DIR}db* +cp $WORK_DIR$FILE_NAME /etc/bind/zone/master/o/ + +systemctl reload bind9