Improved detection of kernel by ignoring known incorrect values

This commit is contained in:
Michael Boelen 2020-10-16 13:02:01 +02:00
parent 21b5493a1c
commit ba1cff941f
No known key found for this signature in database
GPG Key ID: 26141F77A09D7F04
1 changed files with 12 additions and 0 deletions

View File

@ -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"