From 975177198588aefff4862922d518a6953b33f0b3 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 8 Jan 2018 20:24:21 +0100 Subject: [PATCH] Fix /var/cache/ldapsaisie rights only if not changed Fix /var/cache/ldapsaisie rights only if it own by root:root to allow changed by user (for instance, in case of php-fpm use with a custom user/group). --- debian/ldapsaisie.postinst | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/debian/ldapsaisie.postinst b/debian/ldapsaisie.postinst index b3ff1e05..e8ebd95b 100644 --- a/debian/ldapsaisie.postinst +++ b/debian/ldapsaisie.postinst @@ -1,9 +1,17 @@ #!/bin/sh -chown www-data:adm /var/tmp/ldapsaisie /var/log/ldapsaisie -chmod 750 /var/tmp/ldapsaisie /var/log/ldapsaisie +case "$1" in + configure) + if test "$(stat --format %u:%g /var/cache/ldapsaisie)" = "0:0" + then + chown www-data:adm /var/cache/ldapsaisie /var/log/ldapsaisie + chmod 750 /var/cache/ldapsaisie /var/log/ldapsaisie + fi + break -if [ -f /usr/local/share/ldapsaisie/conf/config.inc.php.dpkg-move ] -then - mv /usr/local/share/ldapsaisie/conf/config.inc.php.dpkg-move /usr/local/share/ldapsaisie/conf/config.inc.php -fi + if [ -f /usr/local/share/ldapsaisie/conf/config.inc.php.dpkg-move ] + then + mv /usr/local/share/ldapsaisie/conf/config.inc.php.dpkg-move /usr/local/share/ldapsaisie/conf/config.inc.php + fi + ;; +esac