]> granicus.if.org Git - pdns/commitdiff
builder-support: finish up ucf removal for sql backends
authorChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Wed, 5 Dec 2018 21:13:41 +0000 (22:13 +0100)
committerChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Thu, 6 Dec 2018 11:21:35 +0000 (12:21 +0100)
21 files changed:
builder-support/debian/authoritative/debian-jessie/pdns-backend-mysql.postinst
builder-support/debian/authoritative/debian-jessie/pdns-backend-mysql.postrm [deleted file]
builder-support/debian/authoritative/debian-jessie/pdns-backend-pgsql.postinst
builder-support/debian/authoritative/debian-jessie/pdns-backend-pgsql.postrm [deleted file]
builder-support/debian/authoritative/debian-jessie/pdns-backend-sqlite3.postinst
builder-support/debian/authoritative/debian-jessie/pdns-backend-sqlite3.postrm [deleted file]
builder-support/debian/authoritative/debian-jessie/pdns-server.preinst
builder-support/debian/authoritative/debian-stretch/pdns-backend-mysql.postinst
builder-support/debian/authoritative/debian-stretch/pdns-backend-mysql.postrm [deleted file]
builder-support/debian/authoritative/debian-stretch/pdns-backend-pgsql.postinst
builder-support/debian/authoritative/debian-stretch/pdns-backend-pgsql.postrm [deleted file]
builder-support/debian/authoritative/debian-stretch/pdns-backend-sqlite3.postinst
builder-support/debian/authoritative/debian-stretch/pdns-backend-sqlite3.postrm [deleted file]
builder-support/debian/authoritative/debian-stretch/pdns-server.preinst
builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-mysql.postinst
builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-mysql.postrm [deleted file]
builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-pgsql.postinst
builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-pgsql.postrm [deleted file]
builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-sqlite3.postinst
builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-sqlite3.postrm [deleted file]
builder-support/debian/authoritative/ubuntu-trusty/pdns-server.preinst

index 1efe63c9dff11d86ec5bbdfd5100a67c3b45e214..c93b3f6f4d1140b54e6704419a99971f7fad2579 100644 (file)
@@ -6,52 +6,25 @@ if [ -n "$PDNSDEBUG" ]; then
   set -x
 fi
 
-PKGNAME="pdns-backend-mysql"
-
-# rename ucf-conffile. This was mostly stolen from cacti.postinst after
-# a short discussion on debian-mentors, see
-# http://lists.debian.org/debian-mentors/2013/07/msg00027.html
-# and the following thread. Thanks to Paul Gevers
-renameconffile() {
-  oldname="$1"
-  newname="$2"
-  sourcefile="$3"
-  if [ -f $oldname ] ; then
-    if [ ! -e $newname ] ; then
-      mv $oldname $newname
-#   else: Don't do anything, leave old file in place
-    fi
-    ucf --purge $oldname
-    ucfr --purge $PKGNAME $oldname
-  elif [ ! -e $newname ] ; then
-#   The file was removed, we should respect that. Unfortunately, we don't
-#   have a proper way to tell ucf that for the new location, so we need
-#   to hack it a bit.
-#   We only need to do this if the target does not already exist. If the
-#   target already exists, we can later call ucf straight as there
-#   is already a version of the file available, althought never
-#   provided by this package, but we can just propose the new file anyway.
-    ucf --debconf-ok $sourcefile $newname
-    ucfr $PKGNAME $newname
-    rm -f $newname
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
   fi
 }
 
-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, 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
-fi
+purge_ucf_registry "pdns-backend-mysql"
+# cleanup from versions before 4.0.0~beta1:
+purge_ucf_registry "pdns-backend-gmysql"
 
-# Activate trigger
 dpkg-trigger pdns-server
 
-ucfr $PKGNAME /etc/powerdns/pdns.d/pdns.local.gmysql.conf
-
 #DEBHELPER#
 
 exit 0
diff --git a/builder-support/debian/authoritative/debian-jessie/pdns-backend-mysql.postrm b/builder-support/debian/authoritative/debian-jessie/pdns-backend-mysql.postrm
deleted file mode 100644 (file)
index bba6146..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ -n "$PDNSDEBUG" ]; then
-  echo "now debugging $0 $@"
-  set -x
-fi
-
-PKGNAME="pdns-backend-mysql"
-
-if [ "$1" = "purge" ]; then
-    # Remove files registered with ucf.
-    if command -v ucfq >/dev/null; then
-      for file in $(ucfq --with-colons "$PKGNAME" | cut --delimiter=: --fields=1); do
-        rm -f ${file}
-        ucf --purge ${file}
-        ucfr --purge $PKGNAME ${file}
-      done
-    else
-      echo >&2 "ucf no longer installed, not cleaning up"
-    fi
-fi
-
-#DEBHELPER#
-
-exit 0
index d4944afca8ff3f0f9e9dee526c87999d6515db27..6a90bea7860af62d907f406117943b56247e6d85 100644 (file)
@@ -6,48 +6,23 @@ if [ -n "$PDNSDEBUG" ]; then
   set -x
 fi
 
-PKGNAME="pdns-backend-pgsql"
-
-# rename ucf-conffile. This was mostly stolen from cacti.postinst after
-# a short discussion on debian-mentors, see
-# http://lists.debian.org/debian-mentors/2013/07/msg00027.html
-# and the following thread. Thanks to Paul Gevers
-renameconffile() {
-  oldname="$1"
-  newname="$2"
-  sourcefile="$3"
-  if [ -f $oldname ] ; then
-    if [ ! -e $newname ] ; then
-      mv $oldname $newname
-#   else: Don't do anything, leave old file in place
-    fi
-    ucf --purge $oldname
-    ucfr --purge $PKGNAME $oldname
-  elif [ ! -e $newname ] ; then
-#   The file was removed, we should respect that. Unfortunately, we don't
-#   have a proper way to tell ucf that for the new location, so we need
-#   to hack it a bit.
-#   We only need to do this if the target does not already exist. If the
-#   target already exists, we can later call ucf straight as there
-#   is already a version of the file available, althought never
-#   provided by this package, but we can just propose the new file anyway.
-    ucf --debconf-ok $sourcefile $newname
-    ucfr $PKGNAME $newname
-    rm -f $newname
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
   fi
 }
 
-if [ "$1" = "configure" ]; then
-  if [ -n "$2" ] && dpkg --compare-versions "$2" lt 3.3; then
-    renameconffile /etc/powerdns/pdns.d/pdns.local.gpgsql /etc/powerdns/pdns.d/pdns.local.gpgsql.conf /dev/null
-  fi
-fi
+purge_ucf_registry "pdns-backend-pgsql"
 
-# Activate trigger
 dpkg-trigger pdns-server
 
-ucfr $PKGNAME /etc/powerdns/pdns.d/pdns.local.gpgsql.conf
-
 #DEBHELPER#
 
 exit 0
diff --git a/builder-support/debian/authoritative/debian-jessie/pdns-backend-pgsql.postrm b/builder-support/debian/authoritative/debian-jessie/pdns-backend-pgsql.postrm
deleted file mode 100644 (file)
index 26a90e6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ -n "$PDNSDEBUG" ]; then
-  echo "now debugging $0 $@"
-  set -x
-fi
-
-PKGNAME="pdns-backend-pgsql"
-
-if [ "$1" = "purge" ]; then
-    # Remove files registered with ucf.
-    UCF="ucf"
-    UCFR="ucfr"
-
-    if command -v ucfq >/dev/null; then
-      for file in $(ucfq --with-colons "$PKGNAME" | cut --delimiter=: --fields=1); do
-        rm -f ${file}
-        ucf --purge ${file}
-        ucfr --purge $PKGNAME ${file}
-      done
-    else
-      echo >&2 "ucf no longer installed, not cleaning up"
-    fi
-fi
-
-#DEBHELPER#
-
-exit 0
index 0e137377da8bb32dd08207e0f3a7f0f7d94c69ed..6de742d8fe9de6395509a0b3f3f4496d82b3297f 100644 (file)
@@ -9,44 +9,20 @@ if [ -n "$PDNSDEBUG" ]; then
   set -x
 fi
 
-PKGNAME="pdns-backend-sqlite3"
-
-# rename ucf-conffile. This was mostly stolen from cacti.postinst after
-# a short discussion on debian-mentors, see
-# http://lists.debian.org/debian-mentors/2013/07/msg00027.html
-# and the following thread. Thanks to Paul Gevers
-renameconffile() {
-  oldname="$1"
-  newname="$2"
-  sourcefile="$3"
-  if [ -f $oldname ] ; then
-    if [ ! -e $newname ] ; then
-      mv $oldname $newname
-#   else: Don't do anything, leave old file in place
-    fi
-    ucf --purge $oldname
-    ucfr --purge $PKGNAME $oldname
-  elif [ ! -e $newname ] ; then
-#   The file was removed, we should respect that. Unfortunately, we don't
-#   have a proper way to tell ucf that for the new location, so we need
-#   to hack it a bit.
-#   We only need to do this if the target does not already exist. If the
-#   target already exists, we can later call ucf straight as there
-#   is already a version of the file available, althought never
-#   provided by this package, but we can just propose the new file anyway.
-    ucf --debconf-ok $sourcefile $newname
-    ucfr $PKGNAME $newname
-    rm -f $newname
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
   fi
 }
 
-if [ "$1" = "configure" ]; then
-  if [ -n "$2" ] && dpkg --compare-versions "$2" lt 3.3; then
-    renameconffile /etc/powerdns/pdns.d/pdns.local.gsqlite3 /etc/powerdns/pdns.d/pdns.local.gsqlite3.conf /dev/null
-  fi
-fi
-
-ucfr $PKGNAME /etc/powerdns/pdns.d/pdns.local.gsqlite3.conf
+purge_ucf_registry "pdns-backend-sqlite3"
 
 dpkg-trigger pdns-server
 
diff --git a/builder-support/debian/authoritative/debian-jessie/pdns-backend-sqlite3.postrm b/builder-support/debian/authoritative/debian-jessie/pdns-backend-sqlite3.postrm
deleted file mode 100644 (file)
index 7fca5c1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ -n "$PDNSDEBUG" ]; then
-  echo "now debugging $0 $@"
-  set -x
-fi
-
-PKGNAME="pdns-backend-sqlite3"
-
-if [ "$1" = "purge" ]; then
-    # Remove files registered with ucf.
-    if command -v ucfq >/dev/null; then
-      for file in $(ucfq --with-colons "$PKGNAME" | cut --delimiter=: --fields=1); do
-        rm -f ${file}
-        ucf --purge ${file}
-        ucfr --purge $PKGNAME ${file}
-      done
-    else
-      echo >&2 "ucf no longer installed, not cleaning up"
-    fi
-fi
-
-#DEBHELPER#
-
-exit 0
index 1e95bb3c8b35ec680135049809ae28ff48b22e60..502610fb852383838e9f6ddf198bc8fef27001ff 100644 (file)
@@ -16,6 +16,19 @@ ucf_delete_unchanged() {
   fi
 }
 
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
+  fi
+}
+
 backup_conffile() {
   if [ -e "$1" ]; then
     echo "Moving configuration file $1 to $1.dpkg-bak"
@@ -47,6 +60,8 @@ case "$1" in
     # Remove files no longer in the package (and unused)
     rm -f /etc/resolvconf/update.d/pdns
     rm -f /etc/insserv.d/pdns-server
+
+    purge_ucf_registry "pdns-server"
   ;;
 esac
 
index ebc956b363336af825a7599e7aa2c7f2260df5c3..c93b3f6f4d1140b54e6704419a99971f7fad2579 100644 (file)
@@ -6,53 +6,25 @@ if [ -n "$PDNSDEBUG" ]; then
   set -x
 fi
 
-PKGNAME="pdns-backend-mysql"
-
-# rename ucf-conffile. This was mostly stolen from cacti.postinst after
-# a short discussion on debian-mentors, see
-# http://lists.debian.org/debian-mentors/2013/07/msg00027.html
-# and the following thread. Thanks to Paul Gevers
-renameconffile() {
-  oldname="$1"
-  newname="$2"
-  sourcefile="$3"
-  if [ -f $oldname ] ; then
-    if [ ! -e $newname ] ; then
-      mv $oldname $newname
-#   else: Don't do anything, leave old file in place
-    fi
-    ucf --purge $oldname
-    ucfr --purge $PKGNAME $oldname
-  elif [ ! -e $newname ] ; then
-#   The file was removed, we should respect that. Unfortunately, we don't
-#   have a proper way to tell ucf that for the new location, so we need
-#   to hack it a bit.
-#   We only need to do this if the target does not already exist. If the
-#   target already exists, we can later call ucf straight as there
-#   is already a version of the file available, althought never
-#   provided by this package, but we can just propose the new file anyway.
-    ucf --debconf-ok $sourcefile $newname
-    ucfr $PKGNAME $newname
-    rm -f $newname
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
   fi
 }
 
-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, 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
-fi
-
+purge_ucf_registry "pdns-backend-mysql"
+# cleanup from versions before 4.0.0~beta1:
+purge_ucf_registry "pdns-backend-gmysql"
 
-# Activate trigger
 dpkg-trigger pdns-server
 
-ucfr $PKGNAME /etc/powerdns/pdns.d/pdns.local.gmysql.conf
-
 #DEBHELPER#
 
 exit 0
diff --git a/builder-support/debian/authoritative/debian-stretch/pdns-backend-mysql.postrm b/builder-support/debian/authoritative/debian-stretch/pdns-backend-mysql.postrm
deleted file mode 100644 (file)
index bba6146..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ -n "$PDNSDEBUG" ]; then
-  echo "now debugging $0 $@"
-  set -x
-fi
-
-PKGNAME="pdns-backend-mysql"
-
-if [ "$1" = "purge" ]; then
-    # Remove files registered with ucf.
-    if command -v ucfq >/dev/null; then
-      for file in $(ucfq --with-colons "$PKGNAME" | cut --delimiter=: --fields=1); do
-        rm -f ${file}
-        ucf --purge ${file}
-        ucfr --purge $PKGNAME ${file}
-      done
-    else
-      echo >&2 "ucf no longer installed, not cleaning up"
-    fi
-fi
-
-#DEBHELPER#
-
-exit 0
index d4944afca8ff3f0f9e9dee526c87999d6515db27..6a90bea7860af62d907f406117943b56247e6d85 100644 (file)
@@ -6,48 +6,23 @@ if [ -n "$PDNSDEBUG" ]; then
   set -x
 fi
 
-PKGNAME="pdns-backend-pgsql"
-
-# rename ucf-conffile. This was mostly stolen from cacti.postinst after
-# a short discussion on debian-mentors, see
-# http://lists.debian.org/debian-mentors/2013/07/msg00027.html
-# and the following thread. Thanks to Paul Gevers
-renameconffile() {
-  oldname="$1"
-  newname="$2"
-  sourcefile="$3"
-  if [ -f $oldname ] ; then
-    if [ ! -e $newname ] ; then
-      mv $oldname $newname
-#   else: Don't do anything, leave old file in place
-    fi
-    ucf --purge $oldname
-    ucfr --purge $PKGNAME $oldname
-  elif [ ! -e $newname ] ; then
-#   The file was removed, we should respect that. Unfortunately, we don't
-#   have a proper way to tell ucf that for the new location, so we need
-#   to hack it a bit.
-#   We only need to do this if the target does not already exist. If the
-#   target already exists, we can later call ucf straight as there
-#   is already a version of the file available, althought never
-#   provided by this package, but we can just propose the new file anyway.
-    ucf --debconf-ok $sourcefile $newname
-    ucfr $PKGNAME $newname
-    rm -f $newname
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
   fi
 }
 
-if [ "$1" = "configure" ]; then
-  if [ -n "$2" ] && dpkg --compare-versions "$2" lt 3.3; then
-    renameconffile /etc/powerdns/pdns.d/pdns.local.gpgsql /etc/powerdns/pdns.d/pdns.local.gpgsql.conf /dev/null
-  fi
-fi
+purge_ucf_registry "pdns-backend-pgsql"
 
-# Activate trigger
 dpkg-trigger pdns-server
 
-ucfr $PKGNAME /etc/powerdns/pdns.d/pdns.local.gpgsql.conf
-
 #DEBHELPER#
 
 exit 0
diff --git a/builder-support/debian/authoritative/debian-stretch/pdns-backend-pgsql.postrm b/builder-support/debian/authoritative/debian-stretch/pdns-backend-pgsql.postrm
deleted file mode 100644 (file)
index 26a90e6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ -n "$PDNSDEBUG" ]; then
-  echo "now debugging $0 $@"
-  set -x
-fi
-
-PKGNAME="pdns-backend-pgsql"
-
-if [ "$1" = "purge" ]; then
-    # Remove files registered with ucf.
-    UCF="ucf"
-    UCFR="ucfr"
-
-    if command -v ucfq >/dev/null; then
-      for file in $(ucfq --with-colons "$PKGNAME" | cut --delimiter=: --fields=1); do
-        rm -f ${file}
-        ucf --purge ${file}
-        ucfr --purge $PKGNAME ${file}
-      done
-    else
-      echo >&2 "ucf no longer installed, not cleaning up"
-    fi
-fi
-
-#DEBHELPER#
-
-exit 0
index 0e137377da8bb32dd08207e0f3a7f0f7d94c69ed..6de742d8fe9de6395509a0b3f3f4496d82b3297f 100644 (file)
@@ -9,44 +9,20 @@ if [ -n "$PDNSDEBUG" ]; then
   set -x
 fi
 
-PKGNAME="pdns-backend-sqlite3"
-
-# rename ucf-conffile. This was mostly stolen from cacti.postinst after
-# a short discussion on debian-mentors, see
-# http://lists.debian.org/debian-mentors/2013/07/msg00027.html
-# and the following thread. Thanks to Paul Gevers
-renameconffile() {
-  oldname="$1"
-  newname="$2"
-  sourcefile="$3"
-  if [ -f $oldname ] ; then
-    if [ ! -e $newname ] ; then
-      mv $oldname $newname
-#   else: Don't do anything, leave old file in place
-    fi
-    ucf --purge $oldname
-    ucfr --purge $PKGNAME $oldname
-  elif [ ! -e $newname ] ; then
-#   The file was removed, we should respect that. Unfortunately, we don't
-#   have a proper way to tell ucf that for the new location, so we need
-#   to hack it a bit.
-#   We only need to do this if the target does not already exist. If the
-#   target already exists, we can later call ucf straight as there
-#   is already a version of the file available, althought never
-#   provided by this package, but we can just propose the new file anyway.
-    ucf --debconf-ok $sourcefile $newname
-    ucfr $PKGNAME $newname
-    rm -f $newname
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
   fi
 }
 
-if [ "$1" = "configure" ]; then
-  if [ -n "$2" ] && dpkg --compare-versions "$2" lt 3.3; then
-    renameconffile /etc/powerdns/pdns.d/pdns.local.gsqlite3 /etc/powerdns/pdns.d/pdns.local.gsqlite3.conf /dev/null
-  fi
-fi
-
-ucfr $PKGNAME /etc/powerdns/pdns.d/pdns.local.gsqlite3.conf
+purge_ucf_registry "pdns-backend-sqlite3"
 
 dpkg-trigger pdns-server
 
diff --git a/builder-support/debian/authoritative/debian-stretch/pdns-backend-sqlite3.postrm b/builder-support/debian/authoritative/debian-stretch/pdns-backend-sqlite3.postrm
deleted file mode 100644 (file)
index 7fca5c1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ -n "$PDNSDEBUG" ]; then
-  echo "now debugging $0 $@"
-  set -x
-fi
-
-PKGNAME="pdns-backend-sqlite3"
-
-if [ "$1" = "purge" ]; then
-    # Remove files registered with ucf.
-    if command -v ucfq >/dev/null; then
-      for file in $(ucfq --with-colons "$PKGNAME" | cut --delimiter=: --fields=1); do
-        rm -f ${file}
-        ucf --purge ${file}
-        ucfr --purge $PKGNAME ${file}
-      done
-    else
-      echo >&2 "ucf no longer installed, not cleaning up"
-    fi
-fi
-
-#DEBHELPER#
-
-exit 0
index 1e95bb3c8b35ec680135049809ae28ff48b22e60..502610fb852383838e9f6ddf198bc8fef27001ff 100644 (file)
@@ -16,6 +16,19 @@ ucf_delete_unchanged() {
   fi
 }
 
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
+  fi
+}
+
 backup_conffile() {
   if [ -e "$1" ]; then
     echo "Moving configuration file $1 to $1.dpkg-bak"
@@ -47,6 +60,8 @@ case "$1" in
     # Remove files no longer in the package (and unused)
     rm -f /etc/resolvconf/update.d/pdns
     rm -f /etc/insserv.d/pdns-server
+
+    purge_ucf_registry "pdns-server"
   ;;
 esac
 
index 1efe63c9dff11d86ec5bbdfd5100a67c3b45e214..c93b3f6f4d1140b54e6704419a99971f7fad2579 100644 (file)
@@ -6,52 +6,25 @@ if [ -n "$PDNSDEBUG" ]; then
   set -x
 fi
 
-PKGNAME="pdns-backend-mysql"
-
-# rename ucf-conffile. This was mostly stolen from cacti.postinst after
-# a short discussion on debian-mentors, see
-# http://lists.debian.org/debian-mentors/2013/07/msg00027.html
-# and the following thread. Thanks to Paul Gevers
-renameconffile() {
-  oldname="$1"
-  newname="$2"
-  sourcefile="$3"
-  if [ -f $oldname ] ; then
-    if [ ! -e $newname ] ; then
-      mv $oldname $newname
-#   else: Don't do anything, leave old file in place
-    fi
-    ucf --purge $oldname
-    ucfr --purge $PKGNAME $oldname
-  elif [ ! -e $newname ] ; then
-#   The file was removed, we should respect that. Unfortunately, we don't
-#   have a proper way to tell ucf that for the new location, so we need
-#   to hack it a bit.
-#   We only need to do this if the target does not already exist. If the
-#   target already exists, we can later call ucf straight as there
-#   is already a version of the file available, althought never
-#   provided by this package, but we can just propose the new file anyway.
-    ucf --debconf-ok $sourcefile $newname
-    ucfr $PKGNAME $newname
-    rm -f $newname
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
   fi
 }
 
-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, 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
-fi
+purge_ucf_registry "pdns-backend-mysql"
+# cleanup from versions before 4.0.0~beta1:
+purge_ucf_registry "pdns-backend-gmysql"
 
-# Activate trigger
 dpkg-trigger pdns-server
 
-ucfr $PKGNAME /etc/powerdns/pdns.d/pdns.local.gmysql.conf
-
 #DEBHELPER#
 
 exit 0
diff --git a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-mysql.postrm b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-mysql.postrm
deleted file mode 100644 (file)
index bba6146..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ -n "$PDNSDEBUG" ]; then
-  echo "now debugging $0 $@"
-  set -x
-fi
-
-PKGNAME="pdns-backend-mysql"
-
-if [ "$1" = "purge" ]; then
-    # Remove files registered with ucf.
-    if command -v ucfq >/dev/null; then
-      for file in $(ucfq --with-colons "$PKGNAME" | cut --delimiter=: --fields=1); do
-        rm -f ${file}
-        ucf --purge ${file}
-        ucfr --purge $PKGNAME ${file}
-      done
-    else
-      echo >&2 "ucf no longer installed, not cleaning up"
-    fi
-fi
-
-#DEBHELPER#
-
-exit 0
index d4944afca8ff3f0f9e9dee526c87999d6515db27..6a90bea7860af62d907f406117943b56247e6d85 100644 (file)
@@ -6,48 +6,23 @@ if [ -n "$PDNSDEBUG" ]; then
   set -x
 fi
 
-PKGNAME="pdns-backend-pgsql"
-
-# rename ucf-conffile. This was mostly stolen from cacti.postinst after
-# a short discussion on debian-mentors, see
-# http://lists.debian.org/debian-mentors/2013/07/msg00027.html
-# and the following thread. Thanks to Paul Gevers
-renameconffile() {
-  oldname="$1"
-  newname="$2"
-  sourcefile="$3"
-  if [ -f $oldname ] ; then
-    if [ ! -e $newname ] ; then
-      mv $oldname $newname
-#   else: Don't do anything, leave old file in place
-    fi
-    ucf --purge $oldname
-    ucfr --purge $PKGNAME $oldname
-  elif [ ! -e $newname ] ; then
-#   The file was removed, we should respect that. Unfortunately, we don't
-#   have a proper way to tell ucf that for the new location, so we need
-#   to hack it a bit.
-#   We only need to do this if the target does not already exist. If the
-#   target already exists, we can later call ucf straight as there
-#   is already a version of the file available, althought never
-#   provided by this package, but we can just propose the new file anyway.
-    ucf --debconf-ok $sourcefile $newname
-    ucfr $PKGNAME $newname
-    rm -f $newname
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
   fi
 }
 
-if [ "$1" = "configure" ]; then
-  if [ -n "$2" ] && dpkg --compare-versions "$2" lt 3.3; then
-    renameconffile /etc/powerdns/pdns.d/pdns.local.gpgsql /etc/powerdns/pdns.d/pdns.local.gpgsql.conf /dev/null
-  fi
-fi
+purge_ucf_registry "pdns-backend-pgsql"
 
-# Activate trigger
 dpkg-trigger pdns-server
 
-ucfr $PKGNAME /etc/powerdns/pdns.d/pdns.local.gpgsql.conf
-
 #DEBHELPER#
 
 exit 0
diff --git a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-pgsql.postrm b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-pgsql.postrm
deleted file mode 100644 (file)
index 26a90e6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ -n "$PDNSDEBUG" ]; then
-  echo "now debugging $0 $@"
-  set -x
-fi
-
-PKGNAME="pdns-backend-pgsql"
-
-if [ "$1" = "purge" ]; then
-    # Remove files registered with ucf.
-    UCF="ucf"
-    UCFR="ucfr"
-
-    if command -v ucfq >/dev/null; then
-      for file in $(ucfq --with-colons "$PKGNAME" | cut --delimiter=: --fields=1); do
-        rm -f ${file}
-        ucf --purge ${file}
-        ucfr --purge $PKGNAME ${file}
-      done
-    else
-      echo >&2 "ucf no longer installed, not cleaning up"
-    fi
-fi
-
-#DEBHELPER#
-
-exit 0
index 0e137377da8bb32dd08207e0f3a7f0f7d94c69ed..6de742d8fe9de6395509a0b3f3f4496d82b3297f 100644 (file)
@@ -9,44 +9,20 @@ if [ -n "$PDNSDEBUG" ]; then
   set -x
 fi
 
-PKGNAME="pdns-backend-sqlite3"
-
-# rename ucf-conffile. This was mostly stolen from cacti.postinst after
-# a short discussion on debian-mentors, see
-# http://lists.debian.org/debian-mentors/2013/07/msg00027.html
-# and the following thread. Thanks to Paul Gevers
-renameconffile() {
-  oldname="$1"
-  newname="$2"
-  sourcefile="$3"
-  if [ -f $oldname ] ; then
-    if [ ! -e $newname ] ; then
-      mv $oldname $newname
-#   else: Don't do anything, leave old file in place
-    fi
-    ucf --purge $oldname
-    ucfr --purge $PKGNAME $oldname
-  elif [ ! -e $newname ] ; then
-#   The file was removed, we should respect that. Unfortunately, we don't
-#   have a proper way to tell ucf that for the new location, so we need
-#   to hack it a bit.
-#   We only need to do this if the target does not already exist. If the
-#   target already exists, we can later call ucf straight as there
-#   is already a version of the file available, althought never
-#   provided by this package, but we can just propose the new file anyway.
-    ucf --debconf-ok $sourcefile $newname
-    ucfr $PKGNAME $newname
-    rm -f $newname
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
   fi
 }
 
-if [ "$1" = "configure" ]; then
-  if [ -n "$2" ] && dpkg --compare-versions "$2" lt 3.3; then
-    renameconffile /etc/powerdns/pdns.d/pdns.local.gsqlite3 /etc/powerdns/pdns.d/pdns.local.gsqlite3.conf /dev/null
-  fi
-fi
-
-ucfr $PKGNAME /etc/powerdns/pdns.d/pdns.local.gsqlite3.conf
+purge_ucf_registry "pdns-backend-sqlite3"
 
 dpkg-trigger pdns-server
 
diff --git a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-sqlite3.postrm b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-sqlite3.postrm
deleted file mode 100644 (file)
index 7fca5c1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ -n "$PDNSDEBUG" ]; then
-  echo "now debugging $0 $@"
-  set -x
-fi
-
-PKGNAME="pdns-backend-sqlite3"
-
-if [ "$1" = "purge" ]; then
-    # Remove files registered with ucf.
-    if command -v ucfq >/dev/null; then
-      for file in $(ucfq --with-colons "$PKGNAME" | cut --delimiter=: --fields=1); do
-        rm -f ${file}
-        ucf --purge ${file}
-        ucfr --purge $PKGNAME ${file}
-      done
-    else
-      echo >&2 "ucf no longer installed, not cleaning up"
-    fi
-fi
-
-#DEBHELPER#
-
-exit 0
index 1e95bb3c8b35ec680135049809ae28ff48b22e60..502610fb852383838e9f6ddf198bc8fef27001ff 100644 (file)
@@ -16,6 +16,19 @@ ucf_delete_unchanged() {
   fi
 }
 
+purge_ucf_registry() {
+  pkgname="$1"
+  # Remove files previously registered with ucf (but keep the files).
+  # Newer versions no longer use ucf to manage conffiles.
+  # We stopped depending on ucf, so avoid calling ucf when it is not present.
+  if command -v ucfq >/dev/null; then
+    for file in $(ucfq --with-colons "$pkgname" | cut --delimiter=: --fields=1); do
+      ucf --purge ${file}
+      ucfr --purge $pkgname ${file}
+    done
+  fi
+}
+
 backup_conffile() {
   if [ -e "$1" ]; then
     echo "Moving configuration file $1 to $1.dpkg-bak"
@@ -47,6 +60,8 @@ case "$1" in
     # Remove files no longer in the package (and unused)
     rm -f /etc/resolvconf/update.d/pdns
     rm -f /etc/insserv.d/pdns-server
+
+    purge_ucf_registry "pdns-server"
   ;;
 esac