# HG changeset patch # User Tero Marttila # Date 1387483237 -7200 # Node ID 1b02d8075676331c3176d9e861c532290e3f36b4 # Parent 1a313b7b6d4019050215050643efa424a006bf9c cleanup main update script somewhat diff -r 1a313b7b6d40 -r 1b02d8075676 bin/update --- a/bin/update Thu Dec 19 21:04:07 2013 +0200 +++ b/bin/update Thu Dec 19 22:00:37 2013 +0200 @@ -1,8 +1,7 @@ #!/bin/bash # vim: set ft=sh : -set -ue - +# Bootstrap if [ $0 == './update' ]; then SRV=$(pwd) OPT=./opt @@ -12,34 +11,8 @@ cd $SRV fi -# charset for files under etc/ -CHARSET='utf-8' - -# External bins -NAMED_CHECKZONE=/usr/sbin/named-checkzone - -DHCPD=/usr/sbin/dhcpd -DHCPD_CONF=/etc/dhcp/dhcpd.conf -DHCPD_INIT=/etc/init.d/isc-dhcp-server - -HG=/usr/bin/hg -HG_ARGS=(--config trusted.users=root) - -RNDC=/usr/sbin/rndc -RNDC_KEY=/etc/bind/rndc.key - -# Library includes source lib/update -## Flags -# set by do_reload_zone if zone data has actually been reloaded -RELOAD_ZONES= - -## Site settings, used as arguments to scripts -# Origin domain to generate reverse records for in --reverse-zone -REVERSE_DOMAIN=paivola.fi - -## Do things function update { log "Testing hosts..." for hosts in $(list_files etc/hosts); do @@ -86,7 +59,9 @@ for conf in $(list_files etc/dhcp); do update_dhcp_conf "var/dhcp/$conf" "etc/dhcp/$conf" done - +} + +function deploy { ## Check log "Testing zones..." for zone in $(list_files etc/zones); do @@ -98,7 +73,6 @@ check_dhcp $conf done - ## Deploy log "Reload zones..." reload_zones @@ -135,6 +109,7 @@ ## Go update + deploy } main "$@" diff -r 1a313b7b6d40 -r 1b02d8075676 lib/update --- a/lib/update Thu Dec 19 21:04:07 2013 +0200 +++ b/lib/update Thu Dec 19 22:00:37 2013 +0200 @@ -1,5 +1,9 @@ #!/bin/bash # + +## Strict errors +set -ue + ## Library includes for lib in lib/update.*; do source $lib diff -r 1a313b7b6d40 -r 1b02d8075676 lib/update.config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/update.config Thu Dec 19 22:00:37 2013 +0200 @@ -0,0 +1,16 @@ +# charset for files under etc/ +CHARSET='utf-8' + +# External bins +NAMED_CHECKZONE=/usr/sbin/named-checkzone + +DHCPD=/usr/sbin/dhcpd +DHCPD_CONF=/etc/dhcp/dhcpd.conf +DHCPD_INIT=/etc/init.d/isc-dhcp-server + +HG=/usr/bin/hg +HG_ARGS=(--config trusted.users=root) + +RNDC=/usr/sbin/rndc +RNDC_KEY=/etc/bind/rndc.key + diff -r 1a313b7b6d40 -r 1b02d8075676 lib/update.operations --- a/lib/update.operations Thu Dec 19 21:04:07 2013 +0200 +++ b/lib/update.operations Thu Dec 19 22:00:37 2013 +0200 @@ -251,6 +251,9 @@ } ### Deploy +# set by do_reload_zone if zone data has actually been reloaded +RELOAD_ZONES= + ## Run rndc reload function do_reload_zones { # run