From f8b544ad8eef4c7cfea133073d7360cb4e44ddf3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 14:58:25 +0200 Subject: Adding debian version 1.13-2. Signed-off-by: Daniel Baumann --- debian/zutils.preinst | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 debian/zutils.preinst (limited to 'debian/zutils.preinst') diff --git a/debian/zutils.preinst b/debian/zutils.preinst new file mode 100755 index 0000000..3fa0faf --- /dev/null +++ b/debian/zutils.preinst @@ -0,0 +1,59 @@ +#!/bin/sh + +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 "/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 + ;; + + upgrade) + for FILE in zcat zcmp zdiff zegrep zfgrep zgrep + do + TRUENAME=$(dpkg-divert --truename "/usr/bin/${FILE}") + + if [ "${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/${FILE}.gzip.usr-is-merged" "/bin/${FILE}" + elif [ "${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 [ "${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 [ -e "${DPKG_ROOT}${TRUENAME}" ] || [ -h "${DPKG_ROOT}${TRUENAME}" ] + then + mv "${DPKG_ROOT}${TRUENAME}" "${DPKG_ROOT}/bin/${FILE}.gzip.usr-is-merged" + fi + fi + fi + done + ;; + abort-upgrade) + + ;; + + *) + echo "preinst called with unknown argument \`${1}'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 -- cgit v1.2.3