source: genesis/tools/fresh-dns.sh@ 10120

Last change on this file since 10120 was 9955, checked in by rick, 13 years ago

Give hint what is actually going wrong.

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/bin/sh
2#
3# Deploy fresh/changed WL autogenerated DNS zones
4#
5GENESISROOT=`cd $(dirname $0)/..; pwd -P`
6TOOLS="$GENESISROOT/tools"
7CONFIG="$GENESISROOT/nodes"
8STATIC="$GENESISROOT/dns"
9DEPLOYROOT='/etc/namedb/master'
10
11TFILE=`mktemp /tmp/$(basename $0).XXXXX`
12trap "rm $TFILE; exit 1" 1 2 3 15
13
14FORCE_UPDATE=${FORCE_UPDATE:-"no"}
15ACTIVATE=${ACTIVATE:-"yes"}
16
17# Generate new DNS and only complain/die on errors
18(
19 #svn up $GENESISROOT || exit 1
20 #$TOOLS/genesis-to-yaml.pl $CONFIG/*/wleiden.conf || exit 1
21 $TOOLS/gformat.py dns || exit 1
22) 2>&1 > $TFILE || { cat $TFILE; exit 1; }
23
24
25UPDATE_ZONES=""
26# Check all zone files for vadility and updates
27for NEW in $CONFIG/dns/*; do
28 ZONE=`basename $NEW | cut -c 4-`
29 OLD=$DEPLOYROOT/`basename $NEW`
30
31 # Syntax valid?
32 named-checkzone -q $ZONE $NEW
33 if [ $? -ne 0 ] ; then
34 echo "# ERROR: $ZONE FAILED"
35 named-checkzone $ZONE $NEW
36 else
37 echo "# INFO: $ZONE - OK"
38 fi
39
40 if [ -r "$OLD" -a "$FORCE_UPDATE" = "no" ]; then
41 # Contains new data?
42 diff -I 'SOA' $OLD $NEW
43 if [ $? -eq 0 ]; then
44 continue
45 fi
46 fi
47
48 # Deploy
49 if [ "$ACTIVATE" = "yes" ]; then
50 cp $NEW $OLD
51 UPDATE_ZONES="$UPDATE_ZONES $ZONE"
52 fi
53done
54
55# Make sure to reload if updates are executed
56if [ -n "$UPDATE_ZONES" ]; then
57 rndc reload
58fi
Note: See TracBrowser for help on using the repository browser.