summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
;;