Actually, some people pointed out chmod/chown is a bad practice in postinst.
One should use dpkg-statoverride.
So attached is another proposal.
diff -Naur lmarbles-1.0.7.keep//debian/postinst lmarbles-1.0.7/debian/postinst
--- lmarbles-1.0.7.keep//debian/postinst	2011-01-15 14:37:04.000000000 +0100
+++ lmarbles-1.0.7/debian/postinst	2011-10-23 21:34:19.000000000 +0200
@@ -21,10 +21,16 @@
 case "$1" in
     configure)
         # Make the highscore file writable for the 'games' group.
-        chown root:games /var/games/lmarbles/
-        chown root:games /var/games/lmarbles/lmarbles.prfs
-        chmod 775 /var/games/lmarbles
-        chmod 664 /var/games/lmarbles/lmarbles.prfs
+        if ! dpkg-statoverride --list /var/games/lmarbles >/dev/null 2>&1; then
+            dpkg-statoverride --update --add root games 775 /var/games/lmarbles
+        fi
+        if ! dpkg-statoverride --list /var/games/lmarbles/lmarbles.prfs >/dev/null 2>&1; then
+            dpkg-statoverride --update --add root games 664 /var/games/lmarbles/lmarbles.prfs
+		fi
+        # Make the binary g+s 'games' group.
+        if ! dpkg-statoverride --list /usr/games/lmarbles >/dev/null 2>&1; then
+            dpkg-statoverride --update --add root games 2755 /usr/games/lmarbles
+		fi
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
diff -Naur lmarbles-1.0.7.keep//debian/postrm lmarbles-1.0.7/debian/postrm
--- lmarbles-1.0.7.keep//debian/postrm	1970-01-01 01:00:00.000000000 +0100
+++ lmarbles-1.0.7/debian/postrm	2011-10-23 21:34:01.000000000 +0200
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
+# for details, see /usr/doc/packaging-manual/
+
+if [ "$1" = "purge" ]; then
+    dpkg-statoverride --remove /var/games/lmarbles || test $? -eq 2
+    dpkg-statoverride --remove /var/games/lmarbles/lmarbles.prfs || test $? -eq 2
+    dpkg-statoverride --remove /usr/games/lmarbles || test $? -eq 2
+fi
+
+#DEBHELPER#

Reply via email to