bin/update
changeset 584 22b58b938fd0
parent 581 6292cb597954
child 585 65bf391fd2f3
equal deleted inserted replaced
583:b65ce9123039 584:22b58b938fd0
    30 
    30 
    31 DATA=settings
    31 DATA=settings
    32 ZONES=zones
    32 ZONES=zones
    33 SERIALS=$DATA
    33 SERIALS=$DATA
    34 
    34 
       
    35 DHCP_DATA=$DATA/dhcp
       
    36 DHCP_HOSTS=dhcp
       
    37 
    35 # hg repo to commit
    38 # hg repo to commit
    36 REPO=$DATA
    39 REPO=$DATA
    37 
    40 
    38 ## Settings used in lib
    41 ## Settings used in lib
    39 # Hide files under repo in commit diff output..
    42 # Hide files under repo in commit diff output..
    90 DOMAINS=(paivola.fi paivola.net paivola.org paivola.info paivola.mobi xn--pivl-load8j.fi)
    93 DOMAINS=(paivola.fi paivola.net paivola.org paivola.info paivola.mobi xn--pivl-load8j.fi)
    91 
    94 
    92 
    95 
    93 ## Operate!
    96 ## Operate!
    94 # these functions are all defined in lib/update.operations
    97 # these functions are all defined in lib/update.operations
    95 function run {
    98 function run_hosts {
    96     ## Hosts
    99     ## Hosts
    97     # test
   100     # test
    98     log "Testing hosts..."
   101     log "Testing hosts..."
    99         #                   data                            args...
   102         #                   data                            args...
   100         check_hosts         $DATA/paivola.txt               --check-exempt ufc
   103         check_hosts         $DATA/paivola.txt               --check-exempt ufc
   111         update_hosts        $ZONES/hosts/192.168            $DATA/pvl.txt       --reverse-zone 192.168 --reverse-domain pvl -q
   114         update_hosts        $ZONES/hosts/192.168            $DATA/pvl.txt       --reverse-zone 192.168 --reverse-domain pvl -q
   112 
   115 
   113         # XXX: unsupported --forward-zone with pvl.txt
   116         # XXX: unsupported --forward-zone with pvl.txt
   114         # update_hosts    $ZONES/hosts/pvl                    $DATA/pvl.txt      --forward-zone
   117         # update_hosts    $ZONES/hosts/pvl                    $DATA/pvl.txt      --forward-zone
   115         copy_hosts          $ZONES/hosts/pvl                $DATA/pvl.txt
   118         copy_hosts          $ZONES/hosts/pvl                $DATA/pvl.txt
   116 
   119 }
       
   120  
       
   121 function run_zones {
   117     ## Includes
   122     ## Includes
   118     log "Copying zone includes..."
   123     log "Copying zone includes..."
   119         #                   view            zone                    base
   124         #                   view            zone                    base
   120         copy_zone           includes        paivola:internal        paivola.zone.internal
   125         copy_zone           includes        paivola:internal        paivola.zone.internal
   121         copy_zone           includes        paivola:external        paivola.zone.external
   126         copy_zone           includes        paivola:external        paivola.zone.external
   170 
   175 
   171                 # test
   176                 # test
   172                 check_zone      $view       $zone           $zone
   177                 check_zone      $view       $zone           $zone
   173             done
   178             done
   174         done
   179         done
   175 
   180 }
   176     ## Deploy
   181 
   177     log "Deploy zones..."
   182 function run_deploy {
   178         deploy_zones
   183     ## Reload zones
       
   184     log "Reload zones..."
       
   185         reload_zones
   179 
   186 
   180     ## Commit
   187     ## Commit
   181     log "Commit data..."
   188     log "Commit data..."
   182         commit_data
   189         commit_data
   183 }
   190 }
   197     for dir in "common" "hosts" "includes" "${VIEWS[@]}"; do
   204     for dir in "common" "hosts" "includes" "${VIEWS[@]}"; do
   198         ensure_dir $ZONES/$dir
   205         ensure_dir $ZONES/$dir
   199     done
   206     done
   200 
   207 
   201     ## Go
   208     ## Go
   202     run
   209     run_hosts
       
   210     run_zones
       
   211     run_deploy
   203 }
   212 }
   204 
   213 
   205 main "$@"
   214 main "$@"