audit/backport-Cleanup-shell-script-warnings.patch
fangxiuning 99c0f2a3ae change
2024-07-18 21:30:04 +08:00

112 lines
3.0 KiB
Diff

From 79c1212ff38254a961c27d8eb10bc766e412ffe9 Mon Sep 17 00:00:00 2001
From: Steve Grubb <ausearch.1@gmail.com>
Date: Fri, 23 Feb 2024 12:26:05 -0500
Subject: [PATCH] Cleanup shell script warnings
Reference:https://github.com/linux-audit/audit-userspace/commit/79c1212ff38254a961c27d8eb10bc766e412ffe9
Conflict:NA
---
init.d/auditd.reload | 2 +-
init.d/auditd.resume | 2 +-
init.d/auditd.rotate | 2 +-
init.d/auditd.state | 6 +++---
init.d/auditd.stop | 2 +-
init.d/augenrules | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/init.d/auditd.reload b/init.d/auditd.reload
index 53ff2f4..4f09d00 100644
--- a/init.d/auditd.reload
+++ b/init.d/auditd.reload
@@ -3,7 +3,7 @@
# directly supported by systemd
# Check that we are root ... so non-root users stop here
-test $(id -u) = 0 || exit 4
+test "$(id -u)" = "0" || exit 4
printf "Reconfiguring: "
/sbin/augenrules --load
diff --git a/init.d/auditd.resume b/init.d/auditd.resume
index 96189eb..8193bea 100644
--- a/init.d/auditd.resume
+++ b/init.d/auditd.resume
@@ -3,7 +3,7 @@
# directly supported by systemd
# Check that we are root ... so non-root users stop here
-test $(id -u) = 0 || exit 4
+test "$(id -u)" = "0" || exit 4
printf "Resuming logging: "
/sbin/auditctl --signal resume
diff --git a/init.d/auditd.rotate b/init.d/auditd.rotate
index dcb12c2..8bb6553 100644
--- a/init.d/auditd.rotate
+++ b/init.d/auditd.rotate
@@ -3,7 +3,7 @@
# directly supported by systemd
# Check that we are root ... so non-root users stop here
-test $(id -u) = 0 || exit 4
+test "$(id -u)" = "0" || exit 4
printf "Rotating logs: "
/sbin/auditctl --signal rotate
diff --git a/init.d/auditd.state b/init.d/auditd.state
index 6ae0845..c59fe5a 100644
--- a/init.d/auditd.state
+++ b/init.d/auditd.state
@@ -3,7 +3,7 @@
# directly supported by systemd
# Check that we are root ... so non-root users stop here
-test $(id -u) = 0 || exit 4
+test "$(id -u)" = "0" || exit 4
PATH=/sbin:/bin:/usr/bin:/usr/sbin
state_file="/var/run/auditd.state"
@@ -11,10 +11,10 @@ state_file="/var/run/auditd.state"
printf "Getting auditd internal state: "
/sbin/auditctl --signal state
RETVAL=$?
-echo -e "\n"
sleep 1
-if [ $? -eq 0 ] ; then
+if [ $RETVAL -eq 0 ] ; then
if [ -e $state_file ] ; then
+ printf "\n\n"
cat $state_file
fi
fi
diff --git a/init.d/auditd.stop b/init.d/auditd.stop
index 5049285..41c67d6 100644
--- a/init.d/auditd.stop
+++ b/init.d/auditd.stop
@@ -3,7 +3,7 @@
# directly supported by systemd
# Check that we are root ... so non-root users stop here
-test $(id -u) = 0 || exit 4
+test "$(id -u)" = "0" || exit 4
PATH=/sbin:/bin:/usr/bin:/usr/sbin
prog="auditd"
diff --git a/init.d/augenrules b/init.d/augenrules
index ea96aa7..605cfef 100644
--- a/init.d/augenrules
+++ b/init.d/augenrules
@@ -35,7 +35,7 @@ RETVAL=0
usage="Usage: $0 [--check|--load]"
# Delete the interim file on faults
-trap 'rm -f ${TmpRules}; exit 1' 1 2 3 13 15
+trap 'rm -f ${TmpRules}; exit 1' HUP INT QUIT PIPE TERM
try_load() {
if [ $LoadRules -eq 1 ] ; then
--
2.33.0