From: Matthias Kruk Date: Fri, 21 Jan 2022 10:15:06 +0000 (+0900) Subject: debian: Make postinst and postrm scripts use dpkg-statoverride X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=4da9ea1eb1794f53d4b2fd77c8993bcfe8460c2e;p=toolbox 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. --- 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