lib/update.updates
branchdns-new
changeset 87 cb4607af8663
parent 85 4ad9c9b7cd0e
equal deleted inserted replaced
86:2fb003b8ac4c 87:cb4607af8663
   121 
   121 
   122 ## (cached) include paths for zone file
   122 ## (cached) include paths for zone file
   123 function zone_includes {
   123 function zone_includes {
   124     local cache="$1"
   124     local cache="$1"
   125     local src="$2"
   125     local src="$2"
   126     local dir="$3"
   126     local prefix="${3:-}"
   127 
   127 
   128     if [ ! -e "$cache" -o "$cache" -ot "$src" ]; then
   128     if [ ! -e "$cache" -o "$cache" -ot "$src" ]; then
   129         read_zone_includes "$src" > "$cache"
   129         read_zone_includes "$src" > "$cache"
   130     fi
   130     fi
   131 
   131 
   132     while read include; do
   132     while read include; do
   133         echo -n "$dir/$include "
   133         echo -n "$prefix$include "
   134     done < "$cache"
   134     done < "$cache"
   135 }
   135 }
       
   136 
       
   137 ## Search for prefix-matching includes in zone file
       
   138 function zone_includes_grep {
       
   139     local cache="$1"
       
   140     local src="$2"
       
   141     local prefix="$3"
       
   142     
       
   143     for include in $(zone_includes $cache $src); do
       
   144         if [ "${include#$prefix}" != "$include" ]; then
       
   145             echo -n " ${include#$prefix}"
       
   146         fi
       
   147     done
       
   148 }