debian: Let conf files be owned by root:synnefo
[pithos-web-client] / debian / snf-pithos-webclient.postinst
diff --git a/debian/snf-pithos-webclient.postinst b/debian/snf-pithos-webclient.postinst
new file mode 100644 (file)
index 0000000..0441a9c
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+# postinst script for snf-pithos-webclient
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+PKGNAME=snf-pithos-webclient
+
+case "$1" in
+    configure)
+        conf_files=$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \
+            awk '/\/etc\/synnefo/ { print $1 }')
+        for f in $conf_files; do
+          if ! dpkg-statoverride --list $f; then
+            dpkg-statoverride --update --add root synnefo 0640 $f
+          fi
+        done
+
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+