From 9bf968ec5e784c6c310a8e53a6c70f4d16883fb3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 22:24:08 +0200 Subject: Adding debian version 0.8.4. Signed-off-by: Daniel Baumann --- debian/molly-guard.preinst | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 debian/molly-guard.preinst (limited to 'debian/molly-guard.preinst') diff --git a/debian/molly-guard.preinst b/debian/molly-guard.preinst new file mode 100755 index 0000000..1dcd220 --- /dev/null +++ b/debian/molly-guard.preinst @@ -0,0 +1,73 @@ +#!/bin/sh +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + for cmd in halt poweroff reboot shutdown coldreboot ; do + truenameusr="$(dpkg-divert --truename "/usr/sbin/$cmd")" + truenamealias="$(dpkg-divert --truename "/sbin/$cmd")" + rename_flag=--no-rename + if test "$truenameusr" = "/usr/sbin/$cmd" && test "$truenamealias" = "/sbin/$cmd"; then + rename_flag=--rename + fi + if test "$truenameusr" = "/usr/sbin/$cmd"; then + dpkg-divert --package molly-guard --divert "/usr/sbin/$cmd.no-molly-guard" "$rename_flag" --add "/usr/sbin/$cmd" + elif test "$truenameusr" != "/usr/sbin/$cmd.no-molly-guard"; then + dpkg-divert --package molly-guard --no-rename --remove "/usr/sbin/$cmd" + dpkg-divert --package molly-guard --no-rename --divert "/usr/sbin/$cmd.no-molly-guard" --add "/usr/sbin/$cmd" + if test -e "$truenameusr" || test -h "$truenameusr"; then + mv "$truenameusr" "/usr/sbin/$cmd.no-molly-guard" + fi + fi + if test "$truenamealias" = "/sbin/$cmd"; then + # DEP17 M18 duplicated diversion. Can be --removed after trixie. + dpkg-divert --package molly-guard --divert "/sbin/$cmd.no-molly-guard.usr-is-merged" "$rename_flag" --add "/sbin/$cmd" + elif test "$truenamealias" != "/sbin/$cmd.no-molly-guard.usr-is-merged"; then + dpkg-divert --package molly-guard --no-rename --remove "/sbin/$cmd" + dpkg-divert --package molly-guard --no-rename --divert "/sbin/$cmd.no-molly-guard.usr-is-merged" --add "/sbin/$cmd" + if test -e "$truenamealias" || test -h "$truenamealias"; then + mv "$truenamealias" "/sbin/$cmd.no-molly-guard.usr-is-merged" + fi + fi + done + + for cmd in pm-hibernate pm-suspend pm-suspend-hybrid ; do + truename="$(dpkg-divert --truename "/usr/sbin/$cmd")" + if test "$truename" = "/usr/sbin/$cmd"; then + dpkg-divert --package molly-guard --divert "/usr/sbin/$cmd.no-molly-guard" --rename "/usr/sbin/$cmd" + elif test "$truename" != "/usr/sbin/$cmd.no-molly-guard"; then + dpkg-divert --package molly-guard --no-rename --remove "/usr/sbin/$cmd" + dpkg-divert --package molly-guard --divert "/usr/sbin/$cmd.no-molly-guard" --no-rename --add "/usr/sbin/$cmd" + if test -e "$truename" -o -h "$truename"; then + mv "$truename" "/usr/sbin/$cmd.no-molly-guard" + fi + fi + done + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 -- cgit v1.2.3