From b75eb24298f3a587d116e216a03fc7e511785d4f Mon Sep 17 00:00:00 2001 From: "Guilherme G. Piccoli" Date: Fri, 12 Aug 2022 17:26:13 -0300 Subject: [PATCH] kdump-load: Fix the initrd clean-up This is not really related to the upstreaming effort, but many changes happened so it's a lot easier to just add this patch on top of it. The issues are two: first, if the kdump directory is empty, the "find" tool complains, which is harmless but an unnecessary log pollution. But more important, the second issue is related to writing the kernel versions file, which was unreliable - we now fix that by being more explicit in the usage of stdout redirection. Signed-off-by: Guilherme G. Piccoli --- kdump-load.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kdump-load.sh b/kdump-load.sh index 2477ffe..7382a9f 100644 --- a/kdump-load.sh +++ b/kdump-load.sh @@ -69,9 +69,10 @@ create_initrd() { cleanup_unused_initrd() { INSTALLED_KERNELS="${MOUNT_FOLDER}/.installed_kernels" - find /lib/modules/* -maxdepth 0 -type d -exec basename {} \;>"${INSTALLED_KERNELS}" + find /lib/modules/* -maxdepth 0 -type d -exec basename {} \; 1> "${INSTALLED_KERNELS}" - find "${MOUNT_FOLDER}"/* -name "kdump-initrd*" -type f -print0 | while IFS= read -r -d '' file + find "${MOUNT_FOLDER}"/* -name "kdump-initrd*" -type f -print0 2>/dev/null |\ + while IFS= read -r -d '' file do FNAME="$(basename "${file}" .img)" KVER="${FNAME#kdump-initrd-}"