From 1b262cde62fed38f124ed2cdf408ae01de508efc Mon Sep 17 00:00:00 2001 From: Philipp Rudo Date: Tue, 13 Aug 2024 16:12:35 +0200 Subject: [PATCH 06/16] 99earlykdump: fix shellcheck warnings Fix the shellcheck warnings for 99earlykdump. With this $ shellcheck -x dracut/99earlykdump/*.sh now returns without finding. Signed-off-by: Philipp Rudo --- dracut/99earlykdump/early-kdump.sh | 5 +++++ dracut/99earlykdump/module-setup.sh | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/dracut/99earlykdump/early-kdump.sh b/dracut/99earlykdump/early-kdump.sh index a355010..c56ed82 100755 --- a/dracut/99earlykdump/early-kdump.sh +++ b/dracut/99earlykdump/early-kdump.sh @@ -8,9 +8,13 @@ EARLY_KDUMP_KERNEL="" EARLY_KDUMP_CMDLINE="" EARLY_KEXEC_ARGS="" +# shellcheck source=/dev/null . /etc/sysconfig/kdump +# shellcheck source=/dev/null . /lib/dracut-lib.sh +# shellcheck source=SCRIPTDIR/../../kdump-lib.sh . /lib/kdump-lib.sh +# shellcheck source=SCRIPTDIR/../../kdump-logger.sh . /lib/kdump-logger.sh # initiate the kdump logger @@ -41,6 +45,7 @@ early_kdump_load() { prepare_parameters + # shellcheck disable=SC2153 EARLY_KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}") # Here, only output the messages, but do not save these messages diff --git a/dracut/99earlykdump/module-setup.sh b/dracut/99earlykdump/module-setup.sh index 0451118..98486c5 100755 --- a/dracut/99earlykdump/module-setup.sh +++ b/dracut/99earlykdump/module-setup.sh @@ -1,5 +1,6 @@ #!/bin/bash +# shellcheck source=/dev/null . /etc/sysconfig/kdump KDUMP_KERNEL="" @@ -19,11 +20,13 @@ depends() { } prepare_kernel_initrd() { + # shellcheck source=SCRIPTDIR/../../kdump-lib.sh . /lib/kdump/kdump-lib.sh prepare_kdump_bootinfo # $kernel is a variable from dracut + # shellcheck disable=SC2154 if [[ $KDUMP_KERNELVER != "$kernel" ]]; then dwarn "Using kernel version '$KDUMP_KERNELVER' for early kdump," \ "but the initramfs is generated for kernel version '$kernel'" @@ -54,6 +57,7 @@ install() { inst_script "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh" inst_script "/lib/kdump/kdump-lib-initramfs.sh" "/lib/kdump/kdump-lib-initramfs.sh" inst_script "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh" + # shellcheck disable=SC2154 inst_hook cmdline 00 "$moddir/early-kdump.sh" inst_binary "$KDUMP_KERNEL" inst_binary "$KDUMP_INITRD" @@ -61,5 +65,6 @@ install() { ln_r "$KDUMP_KERNEL" "/boot/kernel-earlykdump" ln_r "$KDUMP_INITRD" "/boot/initramfs-earlykdump" + # shellcheck disable=SC2154 chmod -x "${initdir}/$KDUMP_KERNEL" } -- 2.46.1