From 4da9ea1eb1794f53d4b2fd77c8993bcfe8460c2e Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Fri, 21 Jan 2022 19:15:06 +0900 Subject: [PATCH] debian: Make postinst and postrm scripts use dpkg-statoverride The postinst and postrm scripts change the ownership and permissions of /var/lib/toolbox directly, which is discouraged behavior. This commit changes the scripts so they use dpkg-statoverride instead. --- debian/changelog | 10 ++++++++++ debian/postinst | 10 ++++++---- debian/postrm | 8 ++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index bdd8df9..d40478a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +toolbox (0.3.3-1) unstable; urgency=medium + + * Fixes + - debian: Add postinst and postrm scripts creating the toolbox and + toolbox_ipc groups upon installation and removing them upon package + removal + + -- Matthias Kruk Fri, 21 Jan 2022 18:25:25 +0900 + + toolbox (0.3.2-1) unstable; urgency=medium * Fixes diff --git a/debian/postinst b/debian/postinst index ddc2e23..98ed2e4 100755 --- a/debian/postinst +++ b/debian/postinst @@ -6,13 +6,15 @@ main() { # so we don't change it. if addgroup toolbox; then - chown root.toolbox /var/lib/toolbox - chmod 770 /var/lib/toolbox + if ! dpkg-statoverride --list /var/lib/toolbox >/dev/null 2>&1; then + dpkg-statoverride --update --add root toolbox 0770 /var/lib/toolbox + fi fi if addgroup toolbox_ipc; then - chown root.toolbox_ipc /var/lib/toolbox/ipc - chmod 770 /var/lib/toolbox/ipc + if ! dpkg-statoverride --list /var/lib/toolbox/ipc >/dev/null 2>&1; then + dpkg-statoverride --update --add root toolbox_ipc 0770 /var/lib/toolbox/ipc + fi fi return 0 diff --git a/debian/postrm b/debian/postrm index 5c58e05..c8c707e 100755 --- a/debian/postrm +++ b/debian/postrm @@ -1,6 +1,14 @@ #!/bin/sh main() { + if dpkg-statoverride --list /var/lib/toolbox/ipc >/dev/null 2>&1; then + dpkg-statoverride --remove /var/lib/toolbox/ipc + fi + + if dpkg-statoverride --list /var/lib/toolbox >/dev/null 2>&1; then + dpkg-statoverride --remove /var/lib/toolbox + fi + delgroup toolbox delgroup toolbox_ipc -- 2.47.3