kdump-utils/0008-kdumpctl-fix-shellcheck-warnings.patch

76 lines
2.4 KiB
Diff
Raw Normal View History

From e7813e45234e615bf5c937b30294c63c4885c5f9 Mon Sep 17 00:00:00 2001
From: Philipp Rudo <prudo@redhat.com>
Date: Wed, 14 Aug 2024 12:58:17 +0200
Subject: [PATCH 08/16] kdumpctl: fix shellcheck warnings
Fix the shellcheck warnings for kdumpctl. With this
$ $ shellcheck -x kdumpctl
now returns without finding.
While at it make use of the special SCRIPTDIR value for source-path.
Signed-off-by: Philipp Rudo <prudo@redhat.com>
---
kdumpctl | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 1b6f7b9..612a159 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -33,9 +33,9 @@ if [[ ${__SOURCED__:+x} ]]; then
else
KDUMP_LIB_PATH=/lib/kdump
fi
-# shellcheck source=./kdump-lib.sh
+# shellcheck source=SCRIPTDIR/kdump-lib.sh
. $KDUMP_LIB_PATH/kdump-lib.sh
-# shellcheck source=./kdump-logger.sh
+# shellcheck source=SCRIPTDIR/kdump-logger.sh
. $KDUMP_LIB_PATH/kdump-logger.sh
#initiate the kdump logger
@@ -1199,16 +1199,15 @@ get_kernel_size()
check_vmlinux "$img" && get_vmlinux_size "$img" && return 0
# That didn't work, so retry after decompression.
- try_decompress '\037\213\010' xy gunzip "$img" "$tmp" ||
+ if try_decompress '\037\213\010' xy gunzip "$img" "$tmp" ||
try_decompress '\3757zXZ\000' abcde unxz "$img" "$tmp" ||
try_decompress 'BZh' xy bunzip2 "$img" "$tmp" ||
try_decompress '\135\0\0\0' xxx unlzma "$img" "$tmp" ||
try_decompress '\211\114\132' xy 'lzop -d' "$img" "$tmp" ||
try_decompress '\002!L\030' xxx 'lz4 -d' "$img" "$tmp" ||
- try_decompress '(\265/\375' xxx unzstd "$img" "$tmp"
-
- # Finally check for uncompressed images or objects:
- [[ $? -eq 0 ]] && get_vmlinux_size "$tmp" && return 0
+ try_decompress '(\265/\375' xxx unzstd "$img" "$tmp"; then
+ get_vmlinux_size "$tmp" && return 0
+ fi
# Fallback to use iomem
local _size=0 _seg
@@ -1475,14 +1474,14 @@ reset_crashkernel()
exit 1
fi
_opt_fadump=${_opt#*=}
- if ! _dump_mode=$(get_dump_mode_by_fadump_val $_opt_fadump); then
+ if ! _dump_mode=$(get_dump_mode_by_fadump_val "$_opt_fadump"); then
derror "failed to determine dump mode"
exit
fi
;;
--kernel=*)
_val=${_opt#*=}
- if ! _valid_grubby_kernel_path $_val; then
+ if ! _valid_grubby_kernel_path "$_val"; then
derror "Invalid $_opt, please specify a valid kernel path, ALL or DEFAULT"
exit
fi
--
2.46.1