From 93e5c44cc260736428d2cc1dadb6bf2944e0f42f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Mon, 9 May 2016 11:54:53 +0200 Subject: [PATCH] Only use dpkg-divert on Ubuntu 15.10 (Closes: #823515) --- ...hp-common.postrm => php-common.postrm.divert} | 15 --------------- debian/php-common.postrm.in | 16 ++++++++++++++++ ...-common.preinst => php-common.preinst.divert} | 8 -------- debian/php-common.preinst.in | 9 +++++++++ debian/rules | 15 +++++++++++++++ 5 files changed, 40 insertions(+), 23 deletions(-) rename debian/{php-common.postrm => php-common.postrm.divert} (64%) create mode 100644 debian/php-common.postrm.in rename debian/{php-common.preinst => php-common.preinst.divert} (88%) create mode 100644 debian/php-common.preinst.in diff --git a/debian/php-common.postrm b/debian/php-common.postrm.divert similarity index 64% rename from debian/php-common.postrm rename to debian/php-common.postrm.divert index 47414a3..14ea766 100644 --- a/debian/php-common.postrm +++ b/debian/php-common.postrm.divert @@ -1,14 +1,3 @@ -#!/bin/sh -# postrm script for php-common -# -# see: dh_installdeb(1) - -set -e - -if [ "$1" = "purge" ]; then - rm -rf /var/lib/php -fi - if [ "$1" = remove ] ; then dpkg-divert --remove --package php-common --rename \ --divert /usr/bin/phar.php5 \ @@ -17,7 +6,3 @@ if [ "$1" = remove ] ; then --divert /usr/share/man/man1/phar.php5.1.gz \ /usr/share/man/man1/phar.1.gz fi - -#DEBHELPER# - -exit 0 diff --git a/debian/php-common.postrm.in b/debian/php-common.postrm.in new file mode 100644 index 0000000..a7aae69 --- /dev/null +++ b/debian/php-common.postrm.in @@ -0,0 +1,16 @@ +#!/bin/sh +# postrm script for php-common +# +# see: dh_installdeb(1) + +set -e + +if [ "$1" = "purge" ]; then + rm -rf /var/lib/php +fi + +#DIVERT# + +#DEBHELPER# + +exit 0 diff --git a/debian/php-common.preinst b/debian/php-common.preinst.divert similarity index 88% rename from debian/php-common.preinst rename to debian/php-common.preinst.divert index 91d4623..311a35f 100644 --- a/debian/php-common.preinst +++ b/debian/php-common.preinst.divert @@ -1,7 +1,3 @@ -#!/bin/sh - -set -e - if [ "$1" = install ] || [ "$1" = upgrade ] ; then dpkg-divert --add --package php-common --rename \ --divert /usr/bin/phar.php5 \ @@ -10,7 +6,3 @@ if [ "$1" = install ] || [ "$1" = upgrade ] ; then --divert /usr/share/man/man1/phar.php5.1.gz \ /usr/share/man/man1/phar.1.gz fi - -#DEBHELPER# - -exit 0 diff --git a/debian/php-common.preinst.in b/debian/php-common.preinst.in new file mode 100644 index 0000000..e5b9e42 --- /dev/null +++ b/debian/php-common.preinst.in @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +#DIVERT# + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules index 3ac224d..6f36c5c 100755 --- a/debian/rules +++ b/debian/rules @@ -24,6 +24,13 @@ SED=sed export DH_OPTIONS +DIVERT=sed -e '/\#DIVERT\#/ d' +ifeq (Ubuntu,$(DEB_VENDOR)) + ifeq ($(DEB_DISTRIBUTION),wily) + DIVERT=sed -e "/\#DIVERT\#/ r debian/php-common.$${script}.divert" + endif +endif + %: dh $@ @@ -66,6 +73,14 @@ override_dh_fixperms: dh_fixperms -i -pphp-common -X/var/lib/php/sessions dh_fixperms -i --remaining-packages +override_dh_installdeb: + for script in preinst postrm; do \ + $(DIVERT) \ + < debian/php-common.$${script}.in \ + > debian/php-common.$${script}; \ + done + dh_installdeb -i + override_dh_gencontrol: dh_gencontrol -pphp-common -- -v$(PHP_COMMON_DEB_VERSION) dh_gencontrol -pphp-all-dev -- -v$(PHP_COMMON_DEB_VERSION)