ascension

Migrate DNS zones to the GNU Name System
Log | Files | Refs | README | LICENSE

ascension-bind.prerm (1137B)


      1 #!/bin/bash
      2 # prerm script for ascension-bind
      3 #
      4 # see: dh_installdeb(1)
      5 # load debconf library
      6 . /usr/share/debconf/confmodule
      7 
      8 set -e
      9 
     10 # only get the values set during configuration, defaults otherwise
     11 db_get ascension-bind/zones
     12 echo "$RET" | sed 's/ //g' | sed 's/,/\n/g' > selectedzones
     13 readarray zones < selectedzones
     14 rm selectedzones
     15 trimmed=$(echo $zones | tr -d '\n')
     16 if [ -z $trimmed ]; then
     17     echo "There are no zones to migrate"
     18     exit 0
     19 fi
     20 
     21 if [ -f "/etc/bind/named.conf.options.backup" ]; then
     22     mv "/etc/bind/named.conf.options.backup" "/etc/bind/named.conf.options" || true
     23 fi
     24 deb-systemd-invoke restart bind9
     25 
     26 for ZONE in "${zones[@]}"
     27 do
     28     systemctl daemon-reload
     29     ZONE=$( echo "$ZONE" | tr -d '\n')
     30     FILECONV=$( echo "$ZONE" | tr '.' '_')
     31     echo "Stopping and disabling ascension-bind-$FILECONV"
     32     deb-systemd-invoke disable "ascension-bind-$FILECONV"
     33     deb-systemd-invoke stop "ascension-bind-$FILECONV"
     34     unlink "/lib/systemd/system/ascension-bind-$FILECONV.service" || true
     35     rm "/etc/ascension.d/ascension-bind-$FILECONV.service" || true
     36     systemctl daemon-reload
     37 done
     38 
     39 exit 0
     40 #DEBHELPER#