1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#!/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
|