]> granicus.if.org Git - pdns/commitdiff
debian: fix ucf registration (same as Debian bug#816362)
authorChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Tue, 20 Feb 2018 09:54:06 +0000 (10:54 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 30 Apr 2018 16:18:16 +0000 (18:18 +0200)
(cherry picked from commit 597f3ff73b077c4e4d418e9733235c064ccf4551)

build-scripts/debian-authoritative/pdns-backend-mysql.postinst
build-scripts/debian-authoritative/pdns-backend-mysql.postrm

index 77706a0f0ca9fa73d04bb478f3f3d6d0a166904a..d4d7ee922d8f609e74140d0c9756cf432bd62b0e 100644 (file)
@@ -9,7 +9,7 @@ if [ -n "$PDNSDEBUG" ]; then
   set -x
 fi
 
-PKGNAME="pdns-backend-gmysql"
+PKGNAME="pdns-backend-mysql"
 
 # rename ucf-conffile. This was mostly stolen from cacti.postinst after
 # a short discussion on debian-mentors, see
@@ -41,6 +41,10 @@ renameconffile() {
 }
 
 if [ "$1" = "configure" ]; then
+  if ucfq -w /etc/powerdns/pdns.d/pdns.local.gmysql.conf | grep 'pdns-backend-gmysql' >/dev/null; then
+    # before 4.0.0~beta1 (Debian), 4.1.2... (powerdns.com), PKGNAME was incorrectly set to pdns-backend-gmysql. Fix that.
+    ucfr --purge 'pdns-backend-gmysql' '/etc/powerdns/pdns.d/pdns.local.gmysql.conf'
+  fi
   if [ -n "$2" ] && dpkg --compare-versions "$2" lt 3.3; then
     renameconffile /etc/powerdns/pdns.d/pdns.local.gmysql /etc/powerdns/pdns.d/pdns.local.gmysql.conf /dev/null
   fi
index a2702244cde8bc2ba180f36d22d1a078a08af5d9..378688ed15dd02d042ce338f355feeb173c9bac4 100644 (file)
@@ -14,24 +14,11 @@ PKGNAME="pdns-backend-mysql"
 # Remove configuration file
 if [ "$1" = "purge" ]; then
     # Remove files registered with ucf.
-    # this has been pulled from aide-common.postrm
-
-    UCF="ucf"
-    UCFR="ucfr"
-
     if command -v ucfq >/dev/null; then
       for file in $(ucfq --with-colons "$PKGNAME" | cut --delimiter=: --fields=1); do
-        for ext in '~' '%' .bak .dpkg-tmp .dpkg-new .dpkg-old .dpkg-dist;  do
-          rm -f ${file}$ext
-        done
         rm -f ${file}
-
-        if command -v $UCF >/dev/null; then
-          $UCF --purge ${file}
-        fi
-        if command -v $UCFR >/dev/null; then
-          $UCFR --purge $PKGNAME ${file}
-        fi
+        ucf --purge ${file}
+        ucfr --purge $PKGNAME ${file}
       done
     else
       echo >&2 "ucf no longer installed, not cleaning up"