Skip to content

Commit

Permalink
Separate named.conf generation (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Prandzioch committed Apr 11, 2018
1 parent f5f186e commit 2908b88
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[ -z "$ZONE" ] && echo "ZONE not set" && exit 1;
[ -z "$RECORD_TTL" ] && echo "RECORD_TTL not set" && exit 1;

if [ ! -f /var/cache/bind/$ZONE.zone ]
if ! grep 'zone "'$ZONE'"' /etc/bind/named.conf > /dev/null
then
echo "creating zone...";
cat >> /etc/bind/named.conf <<EOF
Expand All @@ -16,7 +16,10 @@ zone "$ZONE" {
allow-update { localhost; };
};
EOF

fi

if [ ! -f /var/cache/bind/$ZONE.zone ]
then
echo "creating zone file..."
cat > /var/cache/bind/$ZONE.zone <<EOF
\$ORIGIN .
Expand Down

0 comments on commit 2908b88

Please sign in to comment.