From 3bcd18efc2dcc7efce9c71cc3ca70f44889331c3 Mon Sep 17 00:00:00 2001 From: Stefan Yakubov Date: Thu, 8 Feb 2024 11:34:22 +0200 Subject: [PATCH] Added sanity check to avoid cosmetics errors when selinux is not used in system. --- cf-nginx-ip-passthrough/cf.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cf-nginx-ip-passthrough/cf.sh b/cf-nginx-ip-passthrough/cf.sh index 9f2a3aa..4d7a947 100644 --- a/cf-nginx-ip-passthrough/cf.sh +++ b/cf-nginx-ip-passthrough/cf.sh @@ -32,7 +32,9 @@ placeConf(){ } isSeEnforcing(){ - seMode=$(getenforce) + if [ ! -z `which getenforce` ] ; then # To avoid cosmetic errors when there are no Selinux binaries + seMode=$(getenforce) + fi if [ "$seMode" == "Enforcing" ] ; then echo "1" else @@ -49,7 +51,7 @@ if [ ! -f $cfConfig ] ; then # CF IP List is missing in conf.d placeConf else - # CF IP List exists in conf.d + # CF IP List exists in conf.d if [[ ! -z "$(cat $cfConfig)" ]] ; then # The list is not empty. Back up the previous one and install the new one. cp $cfConfig{,.bkp} && placeConf @@ -84,4 +86,3 @@ fi exit 0 -