]> git.corax.cc Git - toolbox/commitdiff
debian: Make postinst and postrm scripts use dpkg-statoverride
authorMatthias Kruk <m@m10k.eu>
Fri, 21 Jan 2022 10:15:06 +0000 (19:15 +0900)
committerMatthias Kruk <m@m10k.eu>
Fri, 21 Jan 2022 10:15:06 +0000 (19:15 +0900)
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
debian/postinst
debian/postrm

index bdd8df97058d6426a7c675acaa64e7bc52875ba6..d40478a9f25db577fba160bdacce3e82f6813664 100644 (file)
@@ -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 <m@m10k.eu>  Fri, 21 Jan 2022 18:25:25 +0900
+
+
 toolbox (0.3.2-1) unstable; urgency=medium
 
   * Fixes
index ddc2e2321283eb37643ebffca45d1971a28f9186..98ed2e45c607186bdb4997ec628d32348abc52ec 100755 (executable)
@@ -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
index 5c58e059be2a2502c6ca8dd8c4ee7c171950a432..c8c707e0a4c25342ab4a7f9c1a9ded6677c5ed85 100755 (executable)
@@ -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