knotendns.j2 456 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. LINK="https://karte.{{freifunk.domain}}/data/nodes.zone"
  3. function update_dns {
  4. mv nodes.zone nodes.alt
  5. {% for domain in domains %}
  6. sed -e 's/{{freifunk.domain}}/{{domain}}/g' nodes.alt > db.knoten.{{domain}}
  7. {% endfor %}
  8. systemctl reload bind9.service
  9. }
  10. function download_nodes_file {
  11. wget $LINK
  12. }
  13. cd /etc/bind
  14. download_nodes_file
  15. diff -I 'serial number' nodes.alt nodes.zone
  16. if [[ $? != "0" ]]
  17. then
  18. update_dns
  19. else
  20. rm nodes.zone
  21. fi