#!/bin/sh
# $Cambridge: hermes/conf/bind/bin/addzone-slave,v 1.3 2011/05/24 15:46:23 fanf2 Exp $

set -e

PATH="/opt/bind/bin:$PATH"

case "$#" in
0|1)
	echo 'usage: addzone-slave <zone> <master...>' 1>&2
	exit 1
esac

zone="${1%.}"
shift

masters=""
for m in "$@"
do
	masters="$masters		$m;
"
done

rndc addzone "$zone" '{
	type slave;
	file "/zs/'"$zone"'";
	masterfile-format raw;
	masters {
'"$masters"'
	};
};'

exit 0
