#!/bin/sh
#
# Update local autoritive DNS server
#
fetch -T 5 -o /tmp/dns.tar.gz.enc http://wirelessleiden.nl/dns/latest.tar.gz.enc || exit 1

# Check if file has transfered succesfully
openssl enc -bf -pass pass:dns -in /tmp/dns.tar.gz.enc -out /dev/null -d 2>/dev/null || exit 1

# Unpack files
openssl enc -bf -pass pass:dns -in /tmp/dns.tar.gz.enc -d | tar -C /tmp -xzvf -

# Reload autoritive DNS Server
nsd-control reload
