source: alternc/trunk/debian/preinst @ 2047

Revision 2047, 2.9 KB checked in by anarcat, 7 years ago (diff)

do the bind zonefiles migration for all versions before 0.9.4 (instead of all before and including 0.9.3), since it's the only known version with that proper configuration. Closes: #1077

Line 
1#!/bin/sh
2
3set -e
4
5. /usr/share/debconf/confmodule
6
7case "$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 [ ! -h /var/alternc/bureau/admin/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            ln -sf /etc/alternc/menulist.txt \
63                  /var/alternc/bureau/admin/menulist.txt
64        fi
65    fi
66
67    # make sure we have a symlink for basedir_prot.sh
68    if [ ! -h /etc/apache/conf.d/override.php.conf ]; then
69        # make sur the file exists so that apache doesn't crash
70        touch /var/alternc/apacheconf/override_php.conf
71        ln -sf /var/alternc/apacheconf/override_php.conf \
72            /etc/apache/conf.d/override.php.conf
73    fi
74
75    ;;
76
77  abort-upgrade)
78    ;;
79
80  *)
81    echo "preinst called with unknown argument '$1'" >&2
82    exit 1
83    ;;
84
85esac
86
87#DEBHELPER#
88
89# vim: et sw=4
Note: See TracBrowser for help on using the repository browser.