From 2ec8037f50806e2b975b6426b4dc912fe2cecf9b Mon Sep 17 00:00:00 2001 From: Mark Schouten Date: Fri, 5 Sep 2014 11:43:26 +0200 Subject: [PATCH] Fix the Debian maintainerscript with versions based on debhelper --- debian-pdns/pdns-doc.postinst | 25 +++++++++++++++++-------- debian-pdns/pdns-doc.prerm | 27 +++++++++++++++++++-------- debian-pdns/pdns.postinst | 35 +++++++++++++++++++---------------- debian-pdns/pdns.postrm | 22 +++++++++++++++------- debian-pdns/pdns.prerm | 29 ++++++++++++++++++++++------- 5 files changed, 92 insertions(+), 46 deletions(-) mode change 100755 => 100644 debian-pdns/pdns-doc.postinst mode change 100755 => 100644 debian-pdns/pdns-doc.prerm diff --git a/debian-pdns/pdns-doc.postinst b/debian-pdns/pdns-doc.postinst old mode 100755 new mode 100644 index 991c191ed3..1bdda286e8 --- a/debian-pdns/pdns-doc.postinst +++ b/debian-pdns/pdns-doc.postinst @@ -1,15 +1,24 @@ #!/bin/sh +# postinst script for pdns set -e -update_docbase() { - if command -v install-docs >/dev/null 2>&1 ; then - install-docs -i /usr/share/doc-base/pdns - fi -} +case "$1" in + configure|abort-upgrade) + if command -v install-docs >/dev/null 2>&1 ; then + install-docs -i /usr/share/doc-base/pdns + fi + ;; + abort-remove|abort-deconfigure) + ;; -if [ "$1" = "configure" -o "$1" = "abort-upgrade" ] ; then - update_docbase -fi + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac +#DEBHELPER# + +exit 0 diff --git a/debian-pdns/pdns-doc.prerm b/debian-pdns/pdns-doc.prerm old mode 100755 new mode 100644 index 378fd30a90..614e989ddd --- a/debian-pdns/pdns-doc.prerm +++ b/debian-pdns/pdns-doc.prerm @@ -1,13 +1,24 @@ #!/bin/sh +# prerm script for pdns set -e -update_docbase() { - if command -v install-docs >/dev/null 2>&1 ; then - install-docs -r pdns - fi -} +case "$1" in + remove) + if command -v install-docs >/dev/null 2>&1 ; then + install-docs -r pdns + fi + ;; -if [ "$1" = "remove" ] ; then - update_docbase -fi + failed-upgrade|upgrade|deconfigure) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian-pdns/pdns.postinst b/debian-pdns/pdns.postinst index 30a43e18a7..b994c9e2a9 100755 --- a/debian-pdns/pdns.postinst +++ b/debian-pdns/pdns.postinst @@ -1,23 +1,26 @@ #!/bin/sh +# postinst script for pdns set -e -update_init() { - if [ -z "$2" ] ; then - update-rc.d pdns defaults 15 85 > /dev/null - fi -} +case "$1" in + configure) + if [ -z $2 ]; then + update-rc.d pdns defaults 15 85 > /dev/null + invoke-rc.d pdns start + else + invoke-rc.d pdns status > /dev/null + [ $? -eq 3 ] || invoke-rc.d pdns restart + fi + ;; + abort-upgrade|abort-remove|abort-deconfigure) + ;; -update_pdns() { - if [ -n "$2" ] ; then - invoke-rc.d pdns start - else - invoke-rc.d pdns restart - fi -} + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac -if [ "$1" = "configure" -o "$1" = "abort-upgrade" ] ; then - update_init "$@" - update_pdns "$@" -fi +exit 0 diff --git a/debian-pdns/pdns.postrm b/debian-pdns/pdns.postrm index 91b80e86fe..02139ffa54 100755 --- a/debian-pdns/pdns.postrm +++ b/debian-pdns/pdns.postrm @@ -1,14 +1,22 @@ #!/bin/sh +# postrm script for pdns set -e -update_init() { - update-rc.d pdns remove > /dev/null -} +case "$1" in + purge|remove) + update-rc.d pdns remove + ;; + |upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; -if [ "$1" = "purge" ] ; then - update_init - rmdir /etc/powerdns || true -fi + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac +#DEBHELPER# + +exit 0 diff --git a/debian-pdns/pdns.prerm b/debian-pdns/pdns.prerm index 8fd3405e00..5a312c7336 100755 --- a/debian-pdns/pdns.prerm +++ b/debian-pdns/pdns.prerm @@ -1,11 +1,26 @@ #!/bin/sh +# prerm script for pdns set -e -if [ "$1" = "remove" ] ; then - if command -v invoke-rc.d >/dev/null 2>&1; then - invoke-rc.d pdns stop - else - /etc/init.d/pdns stop - fi -fi +case "$1" in + remove|upgrade|deconfigure) + if command -v invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d pdns stop + else + /etc/init.d/pdns stop + fi + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 -- 2.47.2