From 2fcf5a7dee7a5f41e10e959646c7201933fb217e Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sat, 22 Jan 2022 16:48:46 +0900 Subject: [PATCH] debian: Don't create/remove groups during upgrades/downgrades The debian maintainer scripts remove and create group during upgrades and downgrades, causing the group ids to change, locking users out of /var/lib/toolbox. This commit modifies the debian maintainer scripts so that they only remove groups during package removals. --- debian/postinst | 7 +++++++ debian/postrm | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/debian/postinst b/debian/postinst index 98ed2e4..154bcad 100755 --- a/debian/postinst +++ b/debian/postinst @@ -1,6 +1,13 @@ #!/bin/sh main() { + action="$1" + + # only add groups and stat overrides when installing + if [ "$action" != "configure" ]; then + return 0 + fi + # If a group exists, there is a chance that the user # has customized directory ownership and permissions, # so we don't change it. diff --git a/debian/postrm b/debian/postrm index c8c707e..6403e9e 100755 --- a/debian/postrm +++ b/debian/postrm @@ -1,6 +1,13 @@ #!/bin/sh main() { + action="$1" + + # don't remove stat overrides if not uninstalling + if [ "$action" != "remove" ]; then + return 0 + fi + if dpkg-statoverride --list /var/lib/toolbox/ipc >/dev/null 2>&1; then dpkg-statoverride --remove /var/lib/toolbox/ipc fi -- 2.47.3