--- a/bin/update Wed Mar 21 16:45:59 2012 +0200
+++ b/bin/update Wed Mar 21 17:04:21 2012 +0200
@@ -32,8 +32,12 @@
ZONES=zones
SERIALS=$DATA
+DHCP=dhcp
DHCP_DATA=$DATA/dhcp
-DHCP_HOSTS=dhcp
+
+# global DHCP conf to test
+DHCPD=/usr/sbin/dhcpd
+DHCPD_CONF=/etc/dhcp/dhcpd.conf
# hg repo to commit
REPO=$DATA
@@ -92,9 +96,13 @@
# List of actual domains used; will be linked to $DOMAIN_BASE
DOMAINS=(paivola.fi paivola.net paivola.org paivola.info paivola.mobi xn--pivl-load8j.fi)
+# Names of dhcp hosts files
+DHCP_HOSTS=(paivola veturi verstas)
## Operate!
# these functions are all defined in lib/update.operations
+
+# Update $ZONES/$DHCP host-files from $DATA
function run_hosts {
## Hosts
# test
@@ -117,7 +125,8 @@
# update_hosts $ZONES/hosts/pvl $DATA/pvl.txt --forward-zone
copy_hosts $ZONES/hosts/pvl $DATA/pvl.txt
}
-
+
+# Update $ZONES files
function run_zones {
## Includes
log "Copying zone includes..."
@@ -179,6 +188,19 @@
done
}
+# Update $DHCP files from $DATA/dhcp
+function run_dhcp {
+ log "Linking DHCP hosts..."
+ for hosts in "${DHCP_HOSTS[@]}"; do
+ # hosts base
+ link_dhcp_hosts $hosts
+ check_dhcp_hosts $hosts
+ done
+
+ log "Testing dhcp..."
+ check_dhcp
+}
+
function run_deploy {
## Reload zones
log "Reload zones..."
@@ -196,18 +218,22 @@
parse_args "$@"
- ## test env
+ ## Input dirs
[ -d $ROOT/$DATA ] || die "Missing data: $ROOT/$DATA"
- ensure_dir $ZONES
## Output dirs
+ for dir in $DHCP $ZONES; do
+ ensure_dir $dir
+ done
+
for dir in "common" "hosts" "includes" "${VIEWS[@]}"; do
- ensure_dir $ZONES/$dir
+ ensure_dir $ZONES/$dir
done
## Go
run_hosts
run_zones
+ run_dhcp
run_deploy
}