| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | set -e |
|---|
| 4 | |
|---|
| 5 | . /usr/share/debconf/confmodule |
|---|
| 6 | |
|---|
| 7 | case "$1" in |
|---|
| 8 | install) |
|---|
| 9 | ;; |
|---|
| 10 | |
|---|
| 11 | upgrade) |
|---|
| 12 | if dpkg --compare-versions "$2" lt "0.9.4"; then |
|---|
| 13 | echo "Upgrading bind configuration" |
|---|
| 14 | # Move /etc/bind files around |
|---|
| 15 | mkdir -p /var/alternc/bind |
|---|
| 16 | if [ ! -e /var/alternc/bind/automatic.conf -a \ |
|---|
| 17 | -f /etc/bind/automatic.conf ]; then |
|---|
| 18 | if [ ! -e /var/alternc/bind/zones ]; then |
|---|
| 19 | mkdir -p /var/alternc/bind/zones |
|---|
| 20 | fi |
|---|
| 21 | for zone in `sed -n -e 's,.*/etc/bind/master/\(.*\)".*,\1,p' \ |
|---|
| 22 | /etc/bind/automatic.conf`; do |
|---|
| 23 | if [ -f /etc/bind/master/$zone ]; then |
|---|
| 24 | mv /etc/bind/master/$zone /var/alternc/bind/zones |
|---|
| 25 | fi |
|---|
| 26 | done |
|---|
| 27 | cp -a -f /etc/bind/automatic.conf /var/alternc/bind/automatic.conf |
|---|
| 28 | sed -e 's,/etc/bind/master,/var/alternc/bind/zones,g' \ |
|---|
| 29 | < /etc/bind/automatic.conf > /var/alternc/bind/automatic.conf |
|---|
| 30 | rm /etc/bind/automatic.conf |
|---|
| 31 | fi |
|---|
| 32 | if [ ! -e /var/alternc/bind/slaveip.conf -a \ |
|---|
| 33 | -f /etc/bind/slaveip.conf ]; then |
|---|
| 34 | mv /etc/bind/slaveip.conf /var/alternc/bind/slaveip.conf |
|---|
| 35 | fi |
|---|
| 36 | if [ ! -e /etc/bind/templates ]; then |
|---|
| 37 | mkdir -p /etc/bind/templates |
|---|
| 38 | fi |
|---|
| 39 | if [ ! -e /etc/bind/templates/named.template -a \ |
|---|
| 40 | -f /etc/bind/domaines.template ]; then |
|---|
| 41 | mv /etc/bind/domaines.template /etc/bind/templates/named.template |
|---|
| 42 | fi |
|---|
| 43 | if [ ! -e /etc/bind/templates/zone.template -a \ |
|---|
| 44 | -f /etc/bind/master/domaines.template ]; then |
|---|
| 45 | mv /etc/bind/master/domaines.template \ |
|---|
| 46 | /etc/bind/templates/zone.template |
|---|
| 47 | fi |
|---|
| 48 | if [ -f /etc/bind/master/mx.template ]; then |
|---|
| 49 | rm /etc/bind/master/mx.template |
|---|
| 50 | fi |
|---|
| 51 | if [ -f /etc/bind/master/slave.template ]; then |
|---|
| 52 | rm /etc/bind/master/slave.template |
|---|
| 53 | fi |
|---|
| 54 | rmdir /etc/bind/master 2> /dev/null || |
|---|
| 55 | echo "/etc/bind/master was not empty. Please remove it manually." |
|---|
| 56 | fi |
|---|
| 57 | |
|---|
| 58 | if [ ! -e /etc/alternc/menulist.txt ]; then |
|---|
| 59 | if [ -f /var/alternc/bureau/admin/menulist.txt ]; then |
|---|
| 60 | mv -f /var/alternc/bureau/admin/menulist.txt \ |
|---|
| 61 | /etc/alternc/menulist.txt |
|---|
| 62 | fi |
|---|
| 63 | fi |
|---|
| 64 | |
|---|
| 65 | ;; |
|---|
| 66 | |
|---|
| 67 | abort-upgrade) |
|---|
| 68 | ;; |
|---|
| 69 | |
|---|
| 70 | *) |
|---|
| 71 | echo "preinst called with unknown argument '$1'" >&2 |
|---|
| 72 | exit 1 |
|---|
| 73 | ;; |
|---|
| 74 | |
|---|
| 75 | esac |
|---|
| 76 | |
|---|
| 77 | #DEBHELPER# |
|---|
| 78 | |
|---|
| 79 | # vim: et sw=4 |
|---|