lib/update.operations
changeset 595 a8160670c3cb
parent 594 e0576a968171
child 597 c21ecf55a736
equal deleted inserted replaced
594:e0576a968171 595:a8160670c3cb
   165     local src=$DATA/$base
   165     local src=$DATA/$base
   166 
   166 
   167     copy_generic $out $src
   167     copy_generic $out $src
   168 }
   168 }
   169 
   169 
       
   170 ## Return the first zone that exists under $DATA/$name.zone
       
   171 #
       
   172 #   base=$(choose_zone $name...)
       
   173 function choose_zone {
       
   174     # look
       
   175     for name in "$@"; do
       
   176         if [ $name ] && [ -e $DATA/$name.zone ]; then
       
   177             echo $name
       
   178             return 0
       
   179         fi
       
   180     done
       
   181     
       
   182     # failed to find
       
   183     die "Unable to find zone in $DATA/*.zone: $@"
       
   184 }
       
   185 
   170 ## Expand zone file from source using $BIN/expand-zone:
   186 ## Expand zone file from source using $BIN/expand-zone:
   171 #
   187 #
   172 #   update_zone $view   $zone   [$base]
   188 #   update_zone $view   $zone   [$base]
   173 #
   189 #
   174 # Processed $DATA/$base zone data through $BIN/expand-zone, writing output to $ZONES/$view/$zone.
   190 # Updates $ZONES/$view/$zone from $DATA/$base.{zone,serial} using $BIN/expand-zone.
   175 function update_zone {
   191 function update_zone {
   176     local view=$1
   192     local view=$1
   177     local zone=$2
   193     local zone=$2
   178     local base=${3:-$zone}
   194     local base=${3:-$zone}
   179 
   195 
       
   196     # zones <- data+serial file
   180     local out=$ZONES/$view/$zone
   197     local out=$ZONES/$view/$zone
   181     local src=$DATA/$base.zone
   198     local src=$DATA/$base.zone
   182     local lnk=$ZONES/$base
       
   183 
       
   184     local serial=$SERIALS/$base.serial
   199     local serial=$SERIALS/$base.serial
   185 
   200 
   186     if check_update $out $src $serial; then
   201     if check_update $out $src $serial; then
   187         log_update "Generating $out <- $src..." 
   202         log_update "Generating $out <- $src..." 
   188 
   203