From: Matthias Kruk Date: Sat, 22 Jan 2022 07:48:46 +0000 (+0900) Subject: debian: Don't create/remove groups during upgrades/downgrades X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=2fcf5a7dee7a5f41e10e959646c7201933fb217e;p=toolbox 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. --- 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