From ed2417c5e1379daba19e4d9793acc394755f620b Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Wed, 5 Dec 2018 22:13:41 +0100 Subject: [PATCH] builder-support: finish up ucf removal for sql backends --- .../debian-jessie/pdns-backend-mysql.postinst | 53 +++++------------- .../debian-jessie/pdns-backend-mysql.postrm | 26 --------- .../debian-jessie/pdns-backend-pgsql.postinst | 47 ++++------------ .../debian-jessie/pdns-backend-pgsql.postrm | 29 ---------- .../pdns-backend-sqlite3.postinst | 46 ++++------------ .../debian-jessie/pdns-backend-sqlite3.postrm | 26 --------- .../debian-jessie/pdns-server.preinst | 15 ++++++ .../pdns-backend-mysql.postinst | 54 +++++-------------- .../debian-stretch/pdns-backend-mysql.postrm | 26 --------- .../pdns-backend-pgsql.postinst | 47 ++++------------ .../debian-stretch/pdns-backend-pgsql.postrm | 29 ---------- .../pdns-backend-sqlite3.postinst | 46 ++++------------ .../pdns-backend-sqlite3.postrm | 26 --------- .../debian-stretch/pdns-server.preinst | 15 ++++++ .../ubuntu-trusty/pdns-backend-mysql.postinst | 53 +++++------------- .../ubuntu-trusty/pdns-backend-mysql.postrm | 26 --------- .../ubuntu-trusty/pdns-backend-pgsql.postinst | 47 ++++------------ .../ubuntu-trusty/pdns-backend-pgsql.postrm | 29 ---------- .../pdns-backend-sqlite3.postinst | 46 ++++------------ .../ubuntu-trusty/pdns-backend-sqlite3.postrm | 26 --------- .../ubuntu-trusty/pdns-server.preinst | 15 ++++++ 21 files changed, 150 insertions(+), 577 deletions(-) delete mode 100644 builder-support/debian/authoritative/debian-jessie/pdns-backend-mysql.postrm delete mode 100644 builder-support/debian/authoritative/debian-jessie/pdns-backend-pgsql.postrm delete mode 100644 builder-support/debian/authoritative/debian-jessie/pdns-backend-sqlite3.postrm delete mode 100644 builder-support/debian/authoritative/debian-stretch/pdns-backend-mysql.postrm delete mode 100644 builder-support/debian/authoritative/debian-stretch/pdns-backend-pgsql.postrm delete mode 100644 builder-support/debian/authoritative/debian-stretch/pdns-backend-sqlite3.postrm delete mode 100644 builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-mysql.postrm delete mode 100644 builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-pgsql.postrm delete mode 100644 builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-sqlite3.postrm diff --git a/builder-support/debian/authoritative/debian-jessie/pdns-backend-mysql.postinst b/builder-support/debian/authoritative/debian-jessie/pdns-backend-mysql.postinst index 1efe63c9df..c93b3f6f4d 100644 --- a/builder-support/debian/authoritative/debian-jessie/pdns-backend-mysql.postinst +++ b/builder-support/debian/authoritative/debian-jessie/pdns-backend-mysql.postinst @@ -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 index bba61463ad..0000000000 --- a/builder-support/debian/authoritative/debian-jessie/pdns-backend-mysql.postrm +++ /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 diff --git a/builder-support/debian/authoritative/debian-jessie/pdns-backend-pgsql.postinst b/builder-support/debian/authoritative/debian-jessie/pdns-backend-pgsql.postinst index d4944afca8..6a90bea786 100644 --- a/builder-support/debian/authoritative/debian-jessie/pdns-backend-pgsql.postinst +++ b/builder-support/debian/authoritative/debian-jessie/pdns-backend-pgsql.postinst @@ -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 index 26a90e61a4..0000000000 --- a/builder-support/debian/authoritative/debian-jessie/pdns-backend-pgsql.postrm +++ /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 diff --git a/builder-support/debian/authoritative/debian-jessie/pdns-backend-sqlite3.postinst b/builder-support/debian/authoritative/debian-jessie/pdns-backend-sqlite3.postinst index 0e137377da..6de742d8fe 100644 --- a/builder-support/debian/authoritative/debian-jessie/pdns-backend-sqlite3.postinst +++ b/builder-support/debian/authoritative/debian-jessie/pdns-backend-sqlite3.postinst @@ -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 index 7fca5c191a..0000000000 --- a/builder-support/debian/authoritative/debian-jessie/pdns-backend-sqlite3.postrm +++ /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 diff --git a/builder-support/debian/authoritative/debian-jessie/pdns-server.preinst b/builder-support/debian/authoritative/debian-jessie/pdns-server.preinst index 1e95bb3c8b..502610fb85 100644 --- a/builder-support/debian/authoritative/debian-jessie/pdns-server.preinst +++ b/builder-support/debian/authoritative/debian-jessie/pdns-server.preinst @@ -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 diff --git a/builder-support/debian/authoritative/debian-stretch/pdns-backend-mysql.postinst b/builder-support/debian/authoritative/debian-stretch/pdns-backend-mysql.postinst index ebc956b363..c93b3f6f4d 100644 --- a/builder-support/debian/authoritative/debian-stretch/pdns-backend-mysql.postinst +++ b/builder-support/debian/authoritative/debian-stretch/pdns-backend-mysql.postinst @@ -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 index bba61463ad..0000000000 --- a/builder-support/debian/authoritative/debian-stretch/pdns-backend-mysql.postrm +++ /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 diff --git a/builder-support/debian/authoritative/debian-stretch/pdns-backend-pgsql.postinst b/builder-support/debian/authoritative/debian-stretch/pdns-backend-pgsql.postinst index d4944afca8..6a90bea786 100644 --- a/builder-support/debian/authoritative/debian-stretch/pdns-backend-pgsql.postinst +++ b/builder-support/debian/authoritative/debian-stretch/pdns-backend-pgsql.postinst @@ -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 index 26a90e61a4..0000000000 --- a/builder-support/debian/authoritative/debian-stretch/pdns-backend-pgsql.postrm +++ /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 diff --git a/builder-support/debian/authoritative/debian-stretch/pdns-backend-sqlite3.postinst b/builder-support/debian/authoritative/debian-stretch/pdns-backend-sqlite3.postinst index 0e137377da..6de742d8fe 100644 --- a/builder-support/debian/authoritative/debian-stretch/pdns-backend-sqlite3.postinst +++ b/builder-support/debian/authoritative/debian-stretch/pdns-backend-sqlite3.postinst @@ -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 index 7fca5c191a..0000000000 --- a/builder-support/debian/authoritative/debian-stretch/pdns-backend-sqlite3.postrm +++ /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 diff --git a/builder-support/debian/authoritative/debian-stretch/pdns-server.preinst b/builder-support/debian/authoritative/debian-stretch/pdns-server.preinst index 1e95bb3c8b..502610fb85 100644 --- a/builder-support/debian/authoritative/debian-stretch/pdns-server.preinst +++ b/builder-support/debian/authoritative/debian-stretch/pdns-server.preinst @@ -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 diff --git a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-mysql.postinst b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-mysql.postinst index 1efe63c9df..c93b3f6f4d 100644 --- a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-mysql.postinst +++ b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-mysql.postinst @@ -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 index bba61463ad..0000000000 --- a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-mysql.postrm +++ /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 diff --git a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-pgsql.postinst b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-pgsql.postinst index d4944afca8..6a90bea786 100644 --- a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-pgsql.postinst +++ b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-pgsql.postinst @@ -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 index 26a90e61a4..0000000000 --- a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-pgsql.postrm +++ /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 diff --git a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-sqlite3.postinst b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-sqlite3.postinst index 0e137377da..6de742d8fe 100644 --- a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-sqlite3.postinst +++ b/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-sqlite3.postinst @@ -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 index 7fca5c191a..0000000000 --- a/builder-support/debian/authoritative/ubuntu-trusty/pdns-backend-sqlite3.postrm +++ /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 diff --git a/builder-support/debian/authoritative/ubuntu-trusty/pdns-server.preinst b/builder-support/debian/authoritative/ubuntu-trusty/pdns-server.preinst index 1e95bb3c8b..502610fb85 100644 --- a/builder-support/debian/authoritative/ubuntu-trusty/pdns-server.preinst +++ b/builder-support/debian/authoritative/ubuntu-trusty/pdns-server.preinst @@ -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 -- 2.47.2