From 801d42ed20698c7fcce30a030028a8f72f062797 Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Tue, 23 Nov 2021 14:51:06 -0500 Subject: [PATCH 1/2] Correct if check to inline the command instead of checking for emptiness of a variable --- salt/common/tools/sbin/soup | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/salt/common/tools/sbin/soup b/salt/common/tools/sbin/soup index 2aefc67bb..fc6694ec2 100755 --- a/salt/common/tools/sbin/soup +++ b/salt/common/tools/sbin/soup @@ -841,8 +841,7 @@ apply_hotfix() { if [[ "$INSTALLEDVERSION" == "2.3.90" && "$HOTFIXVERSION" == "WAZUH" ]] ; then FILE="/nsm/wazuh/etc/ossec.conf" echo "Detecting if ossec.conf needs corrected..." - WAZUHHEADER=$(head -1 $FILE | grep "xml version") - if [[ ! -z "$WAZUHHEADER" ]]; then + if head -1 $FILE | grep "xml version"; then echo "$FILE has an XML header; removing" sed -i 1d $FILE so-wazuh-restart From 4f283c2d8660b4649f29b6861872dcbd797a7f8a Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Tue, 23 Nov 2021 14:52:40 -0500 Subject: [PATCH 2/2] Suppres grep output --- salt/common/tools/sbin/soup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/common/tools/sbin/soup b/salt/common/tools/sbin/soup index fc6694ec2..2244f2735 100755 --- a/salt/common/tools/sbin/soup +++ b/salt/common/tools/sbin/soup @@ -841,7 +841,7 @@ apply_hotfix() { if [[ "$INSTALLEDVERSION" == "2.3.90" && "$HOTFIXVERSION" == "WAZUH" ]] ; then FILE="/nsm/wazuh/etc/ossec.conf" echo "Detecting if ossec.conf needs corrected..." - if head -1 $FILE | grep "xml version"; then + if head -1 $FILE | grep -q "xml version"; then echo "$FILE has an XML header; removing" sed -i 1d $FILE so-wazuh-restart