summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-20 10:17:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-20 10:17:58 +0000
commiteee12802806584d9d501cd525dcd8fef561e6c6c (patch)
tree6ae25c78a6cbd03a2e53f5e3d9c3dc8fc9b679de
parentReleasing debian version 20221002-10. (diff)
downloadprogress-linux-metapackages-eee12802806584d9d501cd525dcd8fef561e6c6c.tar.xz
progress-linux-metapackages-eee12802806584d9d501cd525dcd8fef561e6c6c.zip
Applying patch from Helmut Grohne <helmut@subdivi.de> to duplicate diversion via DEP17 M18 (Closes: #1055511).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rwxr-xr-xdebian/progress-linux-container.postrm6
-rwxr-xr-xdebian/progress-linux-container.preinst42
2 files changed, 29 insertions, 19 deletions
diff --git a/debian/progress-linux-container.postrm b/debian/progress-linux-container.postrm
index 28fccd2..f992a6c 100755
--- a/debian/progress-linux-container.postrm
+++ b/debian/progress-linux-container.postrm
@@ -6,12 +6,12 @@ case "${1}" in
remove)
for FILE in halt poweroff reboot shutdown coldreboot
do
- dpkg-divert --package progress-linux-container --quiet --remove --rename --divert /lib/container/divert/${FILE}.orig /sbin/${FILE}
+ dpkg-divert --package progress-linux-container --quiet --remove --rename --divert "/lib/container/divert/$FILE.orig.usr-is-merged" "/sbin/$FILE"
done
- for FILE in pm-hibernate pm-suspend pm-suspend-hybrid
+ for FILE in halt poweroff reboot shutdown coldreboot pm-hibernate pm-suspend pm-suspend-hybrid
do
- dpkg-divert --package progress-linux-container --quiet --remove --rename --divert /lib/container/divert/${FILE}.orig /usr/sbin/${FILE}
+ dpkg-divert --package progress-linux-container --quiet --remove --rename --divert "/usr/lib/container/divert/$FILE.orig" "/usr/sbin/$FILE"
done
;;
diff --git a/debian/progress-linux-container.preinst b/debian/progress-linux-container.preinst
index ed41ccc..499595b 100755
--- a/debian/progress-linux-container.preinst
+++ b/debian/progress-linux-container.preinst
@@ -4,30 +4,40 @@ set -e
case "${1}" in
install|upgrade)
- # upgrade from bullseye
- if ls /lib/open-infrastructure/container/divert/*.orig > /dev/null 2>&1
- then
- for FILE in halt poweroff reboot shutdown coldreboot
- do
- dpkg-divert --package progress-linux-container --quiet --remove --rename --divert /lib/open-infrastructure/container/divert/${FILE}.orig /sbin/${FILE}
- done
-
- for FILE in pm-hibernate pm-suspend pm-suspend-hybrid
- do
- dpkg-divert --package progress-linux-container --quiet --remove --rename --divert /lib/open-infrastructure/container/divert/${FILE}.orig /usr/sbin/${FILE}
- done
- fi
-
mkdir -p /lib/container/divert
for FILE in halt poweroff reboot shutdown coldreboot
do
- dpkg-divert --package progress-linux-container --quiet --add --rename --divert /lib/container/divert/${FILE}.orig /sbin/${FILE}
+ TRUENAMEUSR=$(dpkg-divert --truename "/usr/sbin/$FILE")
+ TRUENAMEALIAS=$(dpkg-divert --truename "/sbin/$FILE")
+ RENAME_FLAG=--no-rename
+ if test "$TRUENAMEUSR" = "/usr/sbin/$FILE"; then
+ if test "$TRUENAMEALIAS" = "/sbin/$FILE"; then
+ RENAME_FLAG=--rename
+ fi
+ dpkg-divert --package progress-linux-container --quiet --add "$RENAME_FLAG" --divert "/usr/lib/container/divert/$FILE.orig" "/usr/sbin/$FILE"
+ fi
+ # DEP17 M18 duplicated diversion. Can be removed after trixie.
+ if test "$TRUENAMEALIAS" = "/sbin/$FILE"; then
+ dpkg-divert --package progress-linux-container --quiet --add "$RENAME_FLAG" --divert "/lib/container/divert/$FILE.orig.usr-is-merged" "/sbin/$FILE"
+ elif test "$TRUENAMEALIAS" != "/lib/container/divert/$FILE.orig.usr-is-merged"; then
+ dpkg-divert --package progress-linux-container --quiet --remove --no-rename "/sbin/$FILE"
+ dpkg-divert --package progress-linux-container --quiet --add --no-rename --divert "/lib/container/divert/$FILE.orig.usr-is-merged" "/sbin/$FILE"
+ if test -e "$TRUENAMEALIAS" || test -h "$TRUENAMEALIAS"; then
+ mv "$TRUENAMEALIAS" "/lib/container/divert/$FILE.orig.usr-is-merged"
+ fi
+ fi
done
for FILE in pm-hibernate pm-suspend pm-suspend-hybrid
do
- dpkg-divert --package progress-linux-container --quiet --add --rename --divert /lib/container/divert/${FILE}.orig /usr/sbin/${FILE}
+ TRUENAMEUSR=$(dpkg-divert --truename "/usr/sbin/$FILE")
+ if test "$TRUENAMEUSR" = "/lib/container/divert/$FILE.orig"; then
+ dpkg-divert --package progress-linux-container --quiet --remove --no-rename "/usr/sbin/$FILE"
+ dpkg-divert --package progress-linux-container --quiet --add --no-rename --divert "/usr/lib/container/divert/$FILE.orig" "/usr/sbin/$FILE"
+ else
+ dpkg-divert --package progress-linux-container --quiet --add --rename --divert "/usr/lib/container/divert/$FILE.orig" "/usr/sbin/$FILE"
+ fi
done
;;