From 2f87baa5a4330ede008dda35e8dfdaad05ed8c12 Mon Sep 17 00:00:00 2001 From: Laurent Bigonville Date: Sat, 26 Jan 2013 01:12:41 +0100 Subject: [PATCH] Do not hardcode full path to restorecon Use which command to detect if the executable is present or not --- debian/nut-client.postinst | 4 +++- debian/nut-server.postinst | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/nut-client.postinst b/debian/nut-client.postinst index bac6721..4b04850 100644 --- a/debian/nut-client.postinst +++ b/debian/nut-client.postinst @@ -39,7 +39,9 @@ case "$1" in if [ -d /var/run/nut ] ; then chown root:nut /var/run/nut chmod 770 /var/run/nut - [ -x /sbin/restorecon ] && /sbin/restorecon /var/run/nut + if which restorecon >/dev/null 2>&1; then + restorecon /var/run/nut + fi fi if dpkg --compare-versions "$2" le "2.6.4-2~" && diff --git a/debian/nut-server.postinst b/debian/nut-server.postinst index 4a718aa..3322126 100644 --- a/debian/nut-server.postinst +++ b/debian/nut-server.postinst @@ -39,7 +39,9 @@ case "$1" in if [ -d /var/run/nut ] ; then chown root:nut /var/run/nut chmod 770 /var/run/nut - [ -x /sbin/restorecon ] && /sbin/restorecon /var/run/nut + if which restorecon >/dev/null 2>&1; then + restorecon /var/run/nut + fi fi # make sure that /var/lib/nut has the correct permissions and ownerships