Improvements to kernel detection (e.g. Gentoo) [KRNL-5830]

This commit is contained in:
mboelen 2014-09-25 16:55:02 +02:00
parent 10dc6d3930
commit 7f7d869ae5

View File

@ -461,6 +461,8 @@
fi
# Check if /boot exists
if [ -d /boot ]; then
FIND=`ls /boot/* 2> /dev/null`
if [ ! "${FIND}" = "" ]; then
if [ -f /boot/vmlinuz ]; then
logtext "Result: found /boot/vmlinuz"
ReportException "${TEST_NO}:1" "Can't determine kernel version on disk, need debug data"
@ -485,16 +487,20 @@
fi
else
logtext "Result: /boot/vmlinuz not on disk, trying to find /boot/vmlinuz*"
FIND=`ls /boot/vmlinuz* 2> /dev/null`
if [ "${FIND}" = "" ]; then
logtext "Result: No kernels (/boot/vmlinuz*) found on disk"
ReportException "${TEST_NO}:2" "Can not find any vmlinuz files in /boot, which is unexpected"
else
# Replace dashes to allow numeric sort
# Extra current kernel version and replace dashes to allow numeric sort later on
MYKERNEL=`uname -r | sed 's/\.[a-z].*.//g' | sed 's/-[a-z].*.//g' | sed 's/-/./g'`
logtext "Result: using ${MYKERNEL} as my kernel version (stripped)"
FIND=`ls /boot/vmlinuz* 2> /dev/null`
if [ ! "${FIND}" = "" ]; then
# Display kernels, extract version numbers and sort them numeric per column (up to 6 numbers)
KERNELS=`ls /boot/vmlinuz* | sed 's/vmlinuz-//' | sed 's/\.[a-z].*.//g' | sed 's/-[a-z].*.//g' | sed 's./boot/..' | sed 's/-/./g' | sort -n -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -t \.`
elif [ ! `ls /boot/kernel* 2> /dev/null` = "" ]; then
# Display kernels, extract version numbers and sort them numeric per column (up to 6 numbers)
# Examples:
# /boot/kernel-genkernel-x86_64-3.14.14-gentoo
KERNELS=`ls /boot/kernel* | awk -F- '{ if ($2=="genkernel") { print $4 }}' | grep "^[0-9]" | sort -n -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -t \.`
logtext "Result: using ${MYKERNEL} as my kernel version (stripped)"
FOUND_KERNEL=0
for I in ${KERNELS}; do
if [ ${FOUND_KERNEL} -eq 1 ]; then
@ -518,8 +524,14 @@
REBOOT_NEEDED=0
fi
fi
else
ReportException "${TEST_NO}:2" "Can not find any vmlinuz or kernel files in /boot, which is unexpected"
fi
fi
# No files in /boot
else
logtext "Result: Skipping this test, as there are no files in /boot"
fi
else
logtext "Result: /boot does not exist"
fi