summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-08 17:55:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-08 17:55:26 +0000
commitf50b7324beffb5b39c9df62d2de8408d3b3fbd25 (patch)
tree0d7a2183770a2217f4477c043776308b1be2c0c1
parentCorrecting variable name typo in original DEP17 M18 patch. (diff)
downloadzutils-f50b7324beffb5b39c9df62d2de8408d3b3fbd25.tar.xz
zutils-f50b7324beffb5b39c9df62d2de8408d3b3fbd25.zip
Cosmetically harmonizing diversion handling in maintainer scripts for better readability.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rwxr-xr-xdebian/zutils.postrm4
-rwxr-xr-xdebian/zutils.preinst39
2 files changed, 25 insertions, 18 deletions
diff --git a/debian/zutils.postrm b/debian/zutils.postrm
index e9ad406..9a3c7c5 100755
--- a/debian/zutils.postrm
+++ b/debian/zutils.postrm
@@ -6,8 +6,8 @@ case "${1}" in
remove)
for FILE in zcat zcmp zdiff zegrep zfgrep zgrep
do
- 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/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 4795b30..3fa0faf 100755
--- a/debian/zutils.preinst
+++ b/debian/zutils.preinst
@@ -8,8 +8,8 @@ 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/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
;;
@@ -17,21 +17,28 @@ case "${1}" in
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
+ 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 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"
+ 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