}
+#------------------------------------------------------------------------------
+cur_ts() {
+ date +'%Y-%m-%d_%H-%M-%S'
+}
+
+#------------------------------------------------------------------------------
+get_zone() {
+
+ local zone="$1"
+
+ echo >&2
+ info "Get zone '${GREEN}${zone}${NORMAL}' ..."
+
+ local tmpfile=$( mktemp "${zone}.XXXXXXXXXX.zone" )
+
+ dig axfr "${zone}" >"${tmpfile}"
+ if grep -i 'Transfer failed' "${tmpfile}" >/dev/null ; then
+ error "Could not transfer zone '${RED}${zone}${NORMAL}'."
+ else
+ if type -p named-compilezone >/dev/null ; then
+ named-compilezone -o - -s relative "${zone}" "${tmpfile}"
+ else
+ cat "${tmpfile}" | grep -P -v '^\s*(;|$)'
+ fi
+ fi
+
+ RM "${tmpfile}"
+}
+
#------------------------------------------------------------------------------
main() {
get_options "$@"
+ umask 0022
+ local the_zone=
- for zone in "${ZONES[@]}" ; do
- echo >&2
- info "Get zone '${GREEN}${zone}${NORMAL}' ..."
+ set_locale "en_US.utf8"
+ for the_zone in "${ZONES[@]}" ; do
+ get_zone "${the_zone}"
done
}