Suppress SC2181 warning from kdump-lib.sh for the sake of readability.
For the other warning from kdump-migrate-action.sh, fix it following
shellcheck's advice,
In kdump-migrate-action.sh line 4:
if [ $? -ne 0 ]; then
^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not
indirectly with $?.
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdump-lib.sh | 1 +
kdump-migrate-action.sh | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index ec71d77..43dbad5 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -1024,6 +1024,7 @@ get_kernel_size()
try_decompress '(\265/\375' xxx unzstd "$img" "$tmp"
# Finally check for uncompressed images or objects:
+ # shellcheck disable=SC2181 # to improve readability
[[ $? -eq 0 ]] && get_vmlinux_size "$tmp" && return 0
# Fallback to use iomem
diff --git a/kdump-migrate-action.sh b/kdump-migrate-action.sh
index 2fb8366..65e0757 100755
--- a/kdump-migrate-action.sh
+++ b/kdump-migrate-action.sh
@@ -1,7 +1,6 @@
#!/bin/sh
-systemctl is-active kdump
-if [ $? -ne 0 ]; then
+if ! systemctl is-active kdump; then
exit 0
fi
--
2.37.1