summaryrefslogtreecommitdiffstats
path: root/debian/progress-linux-container.preinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/progress-linux-container.preinst')
-rwxr-xr-xdebian/progress-linux-container.preinst67
1 files changed, 67 insertions, 0 deletions
diff --git a/debian/progress-linux-container.preinst b/debian/progress-linux-container.preinst
new file mode 100755
index 0000000..9bf7aac
--- /dev/null
+++ b/debian/progress-linux-container.preinst
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+set -e
+
+case "${1}" in
+ install|upgrade)
+ mkdir -p /usr/lib/container/divert
+
+ for FILE in halt poweroff reboot shutdown coldreboot
+ do
+ TRUENAME_USR="$(dpkg-divert --truename "/usr/sbin/${FILE}")"
+ TRUENAME_ALIAS="$(dpkg-divert --truename "/sbin/${FILE}")"
+ RENAME_FLAG="--no-rename"
+
+ if [ "${TRUENAME_USR}" = "/usr/sbin/${FILE}" ]
+ then
+ if [ "${TRUENAME_ALIAS}" = "/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 [ "${TRUENAME_ALIAS}" = "/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 [ "${TRUENAME_ALIAS}" != "/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 [ -e "${TRUENAME_ALIAS}" ] || [ -h "${TRUENAME_ALIAS}" ]
+ then
+ mv "${TRUENAME_ALIAS}" "/lib/container/divert/${FILE}.orig.usr-is-merged"
+ fi
+ fi
+ done
+
+ for FILE in pm-hibernate pm-suspend pm-suspend-hybrid
+ do
+ TRUENAME_USR="$(dpkg-divert --truename "/usr/sbin/${FILE}")"
+
+ if [ "${TRUENAME_USR}" = "/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
+ ;;
+
+ abort-upgrade)
+
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`${1}'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0