--- a/lib/pvl/hosts/zone.sh Fri Feb 27 17:13:18 2015 +0200
+++ b/lib/pvl/hosts/zone.sh Fri Feb 27 17:25:01 2015 +0200
@@ -64,37 +64,35 @@
fi
}
-## Read include paths from file
-function read_zone_includes {
- cmd sed -n -E 's/^\$INCLUDE\s+"(.+)"/\1/p' "$@"
-}
-## (cached) include paths for zone file
-function zone_includes {
- local cache="$1"
+## Update list of zone $INCLUDEs from zone file
+#
+# update_zone_includes var/include-cache/$zone etc/zones/$zone
+#
+function update_zone_includes {
+ local out="$1"
local src="$2"
- local prefix="${3:-}"
+ local includes="$ZONES_INCLUDE"
- if [ ! -e "$cache" -o "$cache" -ot "$src" ]; then
- read_zone_includes "$src" > "$cache"
+ if [ "$UPDATE_INCLUDES" = 1 ]; then
+ log_force "$out: Force zone includes: $src"
+
+ elif apply_check "$out" "$src"; then
+ log_skip "$out: Skip zone includes: $src"
+
+ return
+
+ elif [ "$UPDATE_INCLUDES" = 0 ]; then
+ log_noop "$out: Noop zone includes: $src"
+
+ return
+ else
+ log_apply "$out: Update zone includes: $src"
fi
- while read include; do
- echo -n "$prefix$include "
- done < "$cache"
-}
-
-## Search for prefix-matching includes in zone file
-function zone_includes_grep {
- local cache="$1"
- local src="$2"
- local prefix="$3"
-
- for include in $(zone_includes $cache $src); do
- if [ "${include#$prefix}" != "$include" ]; then
- echo -n " ${include#$prefix}"
- fi
- done
+ apply_cmd "$out" $OPT/bin/pvl.dns-includes \
+ --include-path=$ZONES_INCLUDE \
+ "$src"
}
## Update the cached .serial for the given zone, if the zone has changed:
@@ -138,6 +136,7 @@
local out="$1"
local src="$2"
local serial="$3"
+ local includes="$4"
local serial_opt=
local msg="$out: Generate zone: $src"