From 27bff721f7f467091ba5d147c3609ff28973ad80 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sun, 12 Aug 2018 23:47:47 +0200 Subject: [PATCH] bind_remove_domain_on_slave.sh: fix error if zone declaration is the last one in zone declaration file. --- bind_remove_domain_on_slave.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bind_remove_domain_on_slave.sh b/bind_remove_domain_on_slave.sh index e3179c0..03852ad 100755 --- a/bind_remove_domain_on_slave.sh +++ b/bind_remove_domain_on_slave.sh @@ -472,6 +472,7 @@ while IFS='' read -r _line || [[ -n $_line ]] ; do if [[ "$_line" =~ type[[:space:]]+slave ]]; then _is_slave=true fi + if $_is_slave && [[ "$_line" =~ ^[[:space:]]*zone[[:space:]]+\"? ]]; then _found=false _last_line=$((line_number - 1)) @@ -483,6 +484,14 @@ while IFS='' read -r _line || [[ -n $_line ]] ; do done < "$ZONES_DECLARATION_FILE" +# - if zone declaration was the last one in file "$ZONES_DECLARATION_FILE" +# - +if $_found && [[ $_last_line -eq 0 ]]; then + _last_line=$line_number + _found=false +fi + + if $_found ; then fatal "Configuration for zone '${DOMAIN_REQUESTED_TO_REMOVE}' was found, but cannot be deleted." fi