# HG changeset patch # User Tero Marttila # Date 1387235869 -7200 # Node ID 77df429f63a3d56ca12b3b96870faa4ad01a7792 # Parent 5a83f2abc0dd50d714501816b510e60c4616dd36 update: full host forward/dhcp/reverse zones diff -r 5a83f2abc0dd -r 77df429f63a3 bin/update --- a/bin/update Tue Dec 17 00:26:44 2013 +0200 +++ b/bin/update Tue Dec 17 01:17:49 2013 +0200 @@ -47,15 +47,27 @@ log_warn "TODO: check_hosts $hosts" done - log "Updating host zones..." + log "Updating forward host zones..." for hosts in $(list_files etc/hosts); do - update_hosts_forward var/zones/hosts/$hosts etc/hosts/$hosts + update_hosts_forward var/zones/hosts/$hosts $hosts \ + etc/hosts/$hosts done log "Updating DHCP hosts..." for hosts in $(list_files etc/hosts); do - update_hosts_dhcp var/dhcp/$hosts.conf etc/hosts/$hosts + update_hosts_dhcp var/dhcp/$hosts.conf \ + etc/hosts/$hosts done + + log "Updating reverse host zones..." + update_hosts_reverse var/zones/hosts/194.197.235 194.197.235.0/24 \ + etc/hosts/paivola.fi etc/hosts/*.paivola.fi + + update_hosts_reverse var/zones/hosts/10.0 10.0.0.0/16 \ + etc/hosts/test.pvl + + update_hosts_reverse var/zones/hosts/fdc4:4cef:395a fdc4:4cef:395a::/48 \ + etc/hosts/test.pvl } function run_zones { diff -r 5a83f2abc0dd -r 77df429f63a3 lib/update.operations --- a/lib/update.operations Tue Dec 17 00:26:44 2013 +0200 +++ b/lib/update.operations Tue Dec 17 01:17:49 2013 +0200 @@ -70,36 +70,61 @@ ## Generate forward zone from hosts hosts using pvl.hosts-dns: # -# update_hosts out/hosts/$hosts in/hosts/$hosts +# update_hosts_forward out/hosts/$hosts $hosts in/hosts/$hosts function update_hosts_forward { - local out=$1 - local src=$2 + local out=$1; shift + local domain=$1; shift + local src=$1; shift - if check_update $out $src; then - log_update "Generating hosts zone $out <- $src..." + if check_update $out $src "$@"; then + log_update "Generating forward hosts zone $out <- $src..." - do_update $out $OPT/bin/pvl.hosts-dns $src \ - --hosts-charset=$CHARSET + do_update $out $OPT/bin/pvl.hosts-dns \ + --hosts-charset=$CHARSET \ + --forward-zone=$domain \ + $src "$@" else - log_skip "Generating hosts $out <- $src: not changed" + log_skip "Generating forward hosts $out <- $src: not changed" fi } function update_hosts_dhcp { - local out=$1 - local src=$2 + local out=$1; shift + local src=$1; shift - if check_update $out $src; then + if check_update $out $src "$@"; then log_update "Generating DHCP hosts $out <- $src..." - do_update $out $OPT/bin/pvl.hosts-dhcp $src \ - --hosts-charset=$CHARSET + do_update $out $OPT/bin/pvl.hosts-dhcp \ + --hosts-charset=$CHARSET \ + $src "$@" else log_skip "Generating DHCP hosts $out <- $src: not changed" fi } +## Generate reverse zone from hosts hosts using pvl.hosts-dns: +# +# update_hosts_reverse out/hosts/$reverse $reverse in/hosts/$hosts +function update_hosts_reverse { + local out=$1; shift + local reverse=$1; shift + local src=$1; shift + + if check_update $out $src "$@"; then + log_update "Generating reverse hosts zone $out <- $src..." + + do_update $out $OPT/bin/pvl.hosts-dns \ + --hosts-charset=$CHARSET \ + --reverse-zone=$reverse \ + $src "$@" + + else + log_skip "Generating reverse hosts $out <- $src: not changed" + fi +} + ## Update .serial number: # # do_update_serial $serial diff -r 5a83f2abc0dd -r 77df429f63a3 lib/update.updates --- a/lib/update.updates Tue Dec 17 00:26:44 2013 +0200 +++ b/lib/update.updates Tue Dec 17 01:17:49 2013 +0200 @@ -36,10 +36,10 @@ [ $update ] && continue # check - if [ ! -e $dep ]; then + if [ ! -e "$dep" ]; then fail "$out: Missing source: $dep" - elif [ $out -ot $dep ]; then + elif [ $out -ot "$dep" ]; then debug " update: $dep" update=y else