From ba1cff941fdc41c06f2cabe494cac3420144e92b Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Fri, 16 Oct 2020 13:02:01 +0200 Subject: [PATCH] Improved detection of kernel by ignoring known incorrect values --- include/tests_kernel | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/tests_kernel b/include/tests_kernel index 011d02c6..7bd11e59 100644 --- a/include/tests_kernel +++ b/include/tests_kernel @@ -680,8 +680,19 @@ elif [ -f "${FOUND_VMLINUZ}" ]; then VERSION_ON_DISK=$(echo ${FOUND_VMLINUZ} | ${SEDBINARY} 's#^/boot/##' | ${SEDBINARY} 's/^vmlinuz-//') LogText "Result: version derived from file name is '${VERSION_ON_DISK}'" + fi + # Data check: perform reset if we found a version but looks incomplete + # Example: Arch Linux will return only 'linux' as its version after it discovered /boot/vmlinuz-linux + case ${VERSION_ON_DISK} in + "linux" | "linux-lts") + LogText "Result: reset of version (${VERSION_ON_DISK}) as it looks incomplete" + VERSION_ON_DISK="" + ;; + esac + + # If we did not find the version yet, see if we can extract it from the magic data that 'file' returns if [ -z "${VERSION_ON_DISK}" ]; then LogText "Test: checking kernel version on disk" NEXTLINE=0 @@ -697,6 +708,7 @@ done fi + # Last check if we finally got a version or not if [ -z "${VERSION_ON_DISK}" ]; then LogText "Result: could not find the version on disk" ReportException "${TEST_NO}:4" "Could not find the kernel version"