summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b09544a)
Replaced direct calls to M4 from the Makefile by calling an auxiliary
script (generated by m4/mkgenzone.m4), which calculates a MD5 hash of
a (suitably normalized) zone file and compares it with a cached hash
of the current version.
The downside is that we run M4 twice on each changed zone. If it ever
causes any harm, we can generate the zone once and move updating of the
version number to the shell script, too.
Based on a patch by Vaclav Ovsik.
o Added FORWARDING macro for generating forward-only zones.
o Added BLACKHOLE macro for blackhole zones as per RFC 6303.
Blackhole zones in example cf/domains updated to use this macro.
o Added FORWARDING macro for generating forward-only zones.
o Added BLACKHOLE macro for blackhole zones as per RFC 6303.
Blackhole zones in example cf/domains updated to use this macro.
appropriate options to BIND config file and include the part
with the list of zones generated by NSC from there. This means
that BIND_OPTIONS, FORWARD and SLAVE are gone.
appropriate options to BIND config file and include the part
with the list of zones generated by NSC from there. This means
that BIND_OPTIONS, FORWARD and SLAVE are gone.
+ o When contents of a zone do not change, the version number is
+ not incremented.
-Version 3.1 [21-05-2008]
+Version 3.1 [2008-05-21]
o Fixes for compatibility problems with recent versions of GNU m4.
o Added support for TXT, RP and SRV records.
o Fixes for compatibility problems with recent versions of GNU m4.
o Added support for TXT, RP and SRV records.
-Version 3.0.1 [22-11-2006]
+Version 3.0.1 [2006-11-22]
Fixed bugs in in the FORWARD and SLAVE macros, causing it to
generate bogus output sometimes.
Fixed bugs in in the FORWARD and SLAVE macros, causing it to
generate bogus output sometimes.
-Version 3.0 [20-02-2005]
+Version 3.0 [2005-02-20]
One year of testing should be good enough, so releasing 2.99b as 3.0
with almost no changes. The only one is:
o ZONE_OPTIONS macro added, allowing to add custom options to zones.
One year of testing should be good enough, so releasing 2.99b as 3.0
with almost no changes. The only one is:
o ZONE_OPTIONS macro added, allowing to add custom options to zones.
-Version 2.99b [21-12-2003]
+Version 2.99b [2003-12-21]
This version has been almost rewritten from scratch. The syntax
of configuration files is incompatible with the previous versions,
This version has been almost rewritten from scratch. The syntax
of configuration files is incompatible with the previous versions,
o Cleaned up names of all macros, the namespaces are now clearly
defined.
o Cleaned up names of all macros, the namespaces are now clearly
defined.
-Version 2.3 [27-06-2001]
+Version 2.3 [2001-06-27]
o Global parameters (hostmaster mail address etc.) can be set
in cf/config now.
o Global parameters (hostmaster mail address etc.) can be set
in cf/config now.
o Fixed bugs in convert script.
o Generate $TTL to make new releases of bind happy.
o Fixed bugs in convert script.
o Generate $TTL to make new releases of bind happy.
-Version 2.2 [11-09-1999]
+Version 2.2 [1999-09-11]
o Corrected localhost records.
o Name-server restart command can be overriden (useful for setups
o Corrected localhost records.
o Name-server restart command can be overriden (useful for setups
freebsd: don't use `-f' in hostname
freebsd: don't use `-f' in hostname
-if a zone doesn't change, don't bump the version
BIND9: `bak' must be owned by the bind user
BIND9: `bak' must be owned by the bind user
fi
$M4 m4/mkconf.m4 $DOMAINS >named.conf
fi
$M4 m4/mkconf.m4 $DOMAINS >named.conf
-$M4 -DM4=$M4 m4/mkmf.m4 $DOMAINS >Makefile
+$M4 m4/mkmf.m4 $DOMAINS >Makefile
+$M4 -DM4=$M4 m4/mkgenzone.m4 >bin/genzone
+chmod +x bin/genzone
define(`ZONEDIR', `zone')
define(`BAKDIR', `bak')
define(`VERSDIR', `ver')
define(`ZONEDIR', `zone')
define(`BAKDIR', `bak')
define(`VERSDIR', `ver')
+define(`HASHDIR', `hash')
define(`ROOTCACHE', `root.cache')
define(`REFRESH', HOURS(8))
define(`ROOTCACHE', `root.cache')
define(`REFRESH', HOURS(8))
--- /dev/null
+dnl ###
+dnl ### NSC -- Zone Generating Script Builder
+dnl ### (c) 2011 Martin Mares <mj@ucw.cz>
+dnl ###
+include(m4/dnslib.m4)
+changecom(REM)
+divert(0)dnl
+#!/bin/sh
+# Please do not modify this script, it is automatically generated by m4/mkgenzone.m4
+
+set -e
+Z=`$'1
+shift
+mkdir -p HASHDIR
+CURRENT_HASH=$(M4 -DHASHING m4/nsc.m4 "$@" | md5sum | cut -d " " -f1)
+PREV_HASH=$(if [ -s HASHDIR/$Z ] ; then cat HASHDIR/$Z ; fi)
+if [ "X$CURRENT_HASH" = "X$PREV_HASH" ] ; then
+ echo "-- $Z: No changes"
+ touch ZONEDIR/$Z HASHDIR/$Z
+else
+ M4 -DVERS=VERSDIR/$Z m4/nsc.m4 "$@" >ZONEDIR/$Z.new
+ mv ZONEDIR/$Z.new ZONEDIR/$Z
+ echo "** $Z: New version $(sed -e "s/^;;; VERSION: //; t; d" ZONEDIR/$Z)"
+ echo $CURRENT_HASH >HASHDIR/$Z
+fi
define(`nsc_prepend_cf_one', ` 'CFDIR/`nsc_file_name($1)')
define(`nsc_prepend_cf_multi', `nsc_iterate(`nsc_prepend_cf_one', $@)')
define(`PRIMARY', `divert(0)ZONEDIR/nsc_file_name($1):nsc_prepend_cf_multi($@) $(DDEPS)
define(`nsc_prepend_cf_one', ` 'CFDIR/`nsc_file_name($1)')
define(`nsc_prepend_cf_multi', `nsc_iterate(`nsc_prepend_cf_one', $@)')
define(`PRIMARY', `divert(0)ZONEDIR/nsc_file_name($1):nsc_prepend_cf_multi($@) $(DDEPS)
- `$'(`M4') -DVERS=VERSDIR/nsc_file_name($1) `$'(NSC)nsc_prepend_cf_multi($@) >ZONEDIR/nsc_file_name($1)
+ @bin/genzone nsc_file_name($1)`'nsc_prepend_cf_multi($@)
divert(-1)
define(`PRIMARIES', PRIMARIES ZONEDIR/nsc_file_name($1))
divert(-1)
define(`PRIMARIES', PRIMARIES ZONEDIR/nsc_file_name($1))
- find BAKDIR ZONEDIR -maxdepth 1 -type f | xargs rm -f
+ find BAKDIR ZONEDIR HASHDIR -maxdepth 1 -type f | xargs rm -f
- rm -f Makefile named.conf
+ rm -f Makefile named.conf bin/genzone
distclean: clobber
find VERSDIR -maxdepth 1 -type f | xargs rm -f
distclean: clobber
find VERSDIR -maxdepth 1 -type f | xargs rm -f
`#' Please don't edit manually
`#'
`#' Please don't edit manually
`#'
-`M4'=M4
-NSC=m4/nsc.m4
-DDEPS=`$'(NSC) m4/dnslib.m4 cf/config
+DDEPS=m4/nsc.m4 m4/dnslib.m4 cf/config
all: VERSDIR/.version
m4wrap(`nsc_cleanup')
all: VERSDIR/.version
m4wrap(`nsc_cleanup')
+ifdef(`HASHING', `define(`VERSION',`YYYYMMDDNN')', `
+
ifdef(`VERS',`',`nsc_fatal_error(`VERS macro not defined')')
define(TODAY_CODE, translit(esyscmd(`date +"%Y%m%d"'),`
ifdef(`VERS',`',`nsc_fatal_error(`VERS macro not defined')')
define(TODAY_CODE, translit(esyscmd(`date +"%Y%m%d"'),`
ifelse(eval(SUBVER_NUM > 99),1,`nsc_fatal_error(`Too many zone changes in a single day, you must tweak 'VERS` manually')')
define(`VERSION',TODAY_CODE`'format(`%02d', SUBVER_NUM))
ifelse(eval(SUBVER_NUM > 99),1,`nsc_fatal_error(`Too many zone changes in a single day, you must tweak 'VERS` manually')')
define(`VERSION',TODAY_CODE`'format(`%02d', SUBVER_NUM))
# Record names
define(nsc_set_name, `define(`CURRENT_NAME', nsc_corr_dot($1))define(`PRINT_NAME', CURRENT_NAME)')
# Record names
define(nsc_set_name, `define(`CURRENT_NAME', nsc_corr_dot($1))define(`PRINT_NAME', CURRENT_NAME)')
divert(0)dnl
`;;;' Primary zone file
divert(0)dnl
`;;;' Primary zone file
-`;;;' Generated by NSCVER (nsc.m4) on CURRENT_DATE
+`;;;' Generated by NSCVER (nsc.m4) on ifdef(`HASHING', ``CURRENT_DATE'', `CURRENT_DATE')
`;;;' Please do not edit manually
`;;;' Please do not edit manually
+`;;;' `VERSION': VERSION