From d54dd5484020cb893751942c476b90fdfad7f6f4 Mon Sep 17 00:00:00 2001 From: Laurent Bigonville Date: Sun, 13 Jan 2013 17:31:58 +0100 Subject: [PATCH] Only fix permissions of configfiles on first install. --- debian/changelog | 5 ++++- debian/nut-client.postinst | 19 +++++++++++-------- debian/nut-server.postinst | 19 +++++++++++-------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/debian/changelog b/debian/changelog index 72f7176..eaf9c73 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,7 +11,10 @@ nut (2.6.5-2) UNRELEASED; urgency=low * debian/nut-client.preinst: revert /etc/nut/nut.conf mangling done by older versions of the postinst (Closes: #677054) - -- Laurent Bigonville Sun, 02 Dec 2012 13:48:20 +0100 + [ Ivo De Decker ] + * Only fix permissions of configfiles on first install. + + -- Laurent Bigonville Sun, 13 Jan 2013 17:31:15 +0100 nut (2.6.5-1) experimental; urgency=low diff --git a/debian/nut-client.postinst b/debian/nut-client.postinst index 5f61e55..e4743f5 100644 --- a/debian/nut-client.postinst +++ b/debian/nut-client.postinst @@ -19,15 +19,18 @@ case "$1" in # fi # make sure that conffiles are secured and have the correct ownerships - if [ -d /etc/nut/ ] ; then - chown root:nut /etc/nut/ - fi - for file in nut.conf upsmon.conf upssched.conf ; do - if [ -f /etc/nut/$file ] ; then - chown root:nut /etc/nut/$file - chmod 640 /etc/nut/$file + # on first install + if [ -z "$2" ] ; then + if [ -d /etc/nut/ ] ; then + chown root:nut /etc/nut/ fi - done + for file in nut.conf upsmon.conf upssched.conf ; do + if [ -f /etc/nut/$file ] ; then + chown root:nut /etc/nut/$file + chmod 640 /etc/nut/$file + fi + done + fi # make sure that /var/run/nut exists and has the correct ownerships if [ ! -d /var/run/nut ] ; then diff --git a/debian/nut-server.postinst b/debian/nut-server.postinst index 8523527..0c653da 100644 --- a/debian/nut-server.postinst +++ b/debian/nut-server.postinst @@ -19,15 +19,18 @@ case "$1" in # fi # make sure that conffiles are secured and have the correct ownerships - if [ -d /etc/nut/ ] ; then - chown root:nut /etc/nut/ - fi - for file in ups.conf upsd.conf upsd.users ; do - if [ -f /etc/nut/$file ] ; then - chown root:nut /etc/nut/$file - chmod 640 /etc/nut/$file + # on first install + if [ -z "$2" ] ; then + if [ -d /etc/nut/ ] ; then + chown root:nut /etc/nut/ fi - done + for file in ups.conf upsd.conf upsd.users ; do + if [ -f /etc/nut/$file ] ; then + chown root:nut /etc/nut/$file + chmod 640 /etc/nut/$file + fi + done + fi # make sure that /var/run/nut exists and has the correct ownerships if [ ! -d /var/run/nut ] ; then