diff options
-rwxr-xr-x | debian/rules | 2 | ||||
-rwxr-xr-x | debian/zutils.postrm | 3 | ||||
-rwxr-xr-x | 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) ;; |