From fb1e6c581d89893dd24f615f8af48e9dbe38d57c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 6 Mar 2024 07:17:42 +0100 Subject: Applying patch from Helmut Grohne to duplicate diversion via DEP17 M18 (Closes: #1059534). Signed-off-by: Daniel Baumann --- debian/rules | 2 +- debian/zutils.postrm | 3 ++- debian/zutils.preinst | 30 ++++++++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/debian/rules b/debian/rules index c401a4b..1085be4 100755 --- a/debian/rules +++ b/debian/rules @@ -6,7 +6,7 @@ include /usr/share/dpkg/buildtools.mk dh ${@} override_dh_auto_configure: - dh_auto_configure -- --exec-prefix=/ CXX=$(CXX) + dh_auto_configure -- CXX=$(CXX) override_dh_auto_install: dh_auto_install -- DESTDIR=$(CURDIR)/debian/zutils diff --git a/debian/zutils.postrm b/debian/zutils.postrm index b9df41b..e9ad406 100755 --- a/debian/zutils.postrm +++ b/debian/zutils.postrm @@ -6,7 +6,8 @@ case "${1}" in remove) for FILE in zcat zcmp zdiff zegrep zfgrep zgrep do - dpkg-divert --package zutils --quiet --remove --rename --divert /bin/${FILE}.gzip /bin/${FILE} + dpkg-divert --package zutils --quiet --remove --rename --divert "/usr/bin/$FILE.gzip" "/usr/bin/$FILE" + dpkg-divert --package zutils --quiet --remove --rename --divert "/bin/$FILE.gzip.usr-is-merged" "/bin/$FILE" dpkg-divert --package zutils --quiet --remove --rename --divert /usr/share/man/man1/${FILE}.gzip.1.gz /usr/share/man/man1/${FILE}.1.gz done ;; diff --git a/debian/zutils.preinst b/debian/zutils.preinst index dde1340..61b5109 100755 --- a/debian/zutils.preinst +++ b/debian/zutils.preinst @@ -2,16 +2,42 @@ set -e +# DEP17 M18: Duplicate diversion in aliased location /bin. + case "${1}" in install) for FILE in zcat zcmp zdiff zegrep zfgrep zgrep do - dpkg-divert --package zutils --quiet --add --rename --divert /bin/${FILE}.gzip /bin/${FILE} + dpkg-divert --package zutils --quiet --add --rename --divert "/usr/bin/$FILE.gzip" "/usr/bin/$FILE" + dpkg-divert --package zutils --quiet --add --rename --divert "/bin/$FILE.gzip.usr-is-merged" "/bin/$FILE" dpkg-divert --package zutils --quiet --add --rename --divert /usr/share/man/man1/${FILE}.gzip.1.gz /usr/share/man/man1/${FILE}.1.gz done ;; - abort-upgrade|upgrade) + upgrade) + for FILE in zcat zcmp zdiff zegrep zfgrep zgrep + do + TRUENAME=$(dpkg-divert --truename "/usr/bin/$FILE") + if test "$TRUENAME" = "/usr/bin/$FILE.usr-is-merged"; then + # gzip.preinst duplicated the diversion for us + dpkg-divert --package zutils --quiet --remove --no-rename --divert "/usr/bin/$FILE.usr-is-merged" "/usr/bin/$FILE" + dpkg-divert --package zutils --quiet --remove --no-rename "/bin/$FILE" + dpkg-divert --package zutils --quiet --add --no-rename --divert "/usr/bin/$FILE.gzip" "/usr/bin/$FILE" + dpkg-divert --package zutils --quiet --add --no-rename --divert "/bin/$TOOL.gzip.usr-is-merged" "/bin/$TOOL" + elif test "$TRUENAME" != "/usr/bin/$FILE.gzip"; then + dpkg-divert --package zutils --quiet --add --no-rename --divert "/usr/bin/$FILE.gzip" "/usr/bin/$FILE" + TRUENAME=$(dpkg-divert --truename "/bin/$FILE") + if test "$TRUENAME" != "/bin/$FILE.gzip.usr-is-merged"; then + dpkg-divert --package zutils --quiet --remove --no-rename "/bin/$FILE" + dpkg-divert --package zutils --quiet --add --no-rename --divert "/bin/$FILE.gzip.usr-is-merged" "/bin/$FILE" + if test -e "$DPKG_ROOT$TRUENAME" -o -h "$DPKG_ROOT$TRUENAME"; then + mv "$DPKG_ROOT$TRUENAME" "$DPKG_ROOT/bin/$FILE.gzip.usr-is-merged" + fi + fi + fi + done + ;; + abort-upgrade) ;; -- cgit v1.2.3