Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormboelen <michael@cisofy.com>2014-12-05 21:42:12 +0300
committermboelen <michael@cisofy.com>2014-12-05 21:42:12 +0300
commit951afea1f3197042267b6d00b0069bc9ac1875bd (patch)
tree1a1ccf969430e7820479fce77472d7fee9410431 /include/tests_kernel
parentdbf9bfd173b126f96e42e5471cd74cdb6f72a2cb (diff)
Enhanced reboot test to work on Arch Linux and others [KRNL-5830]
Diffstat (limited to 'include/tests_kernel')
-rw-r--r--include/tests_kernel22
1 files changed, 20 insertions, 2 deletions
diff --git a/include/tests_kernel b/include/tests_kernel
index 1f4c87d6..1f81c661 100644
--- a/include/tests_kernel
+++ b/include/tests_kernel
@@ -465,8 +465,26 @@
FIND=`ls /boot/* 2> /dev/null`
if [ ! "${FIND}" = "" ]; then
if [ -f /boot/vmlinuz -a ! -L /boot/vmlinuz ]; then
- logtext "Result: found /boot/vmlinuz"
- ReportException "${TEST_NO}:1" "Can't determine kernel version on disk, need debug data"
+ logtext "Result: found /boot/vmlinuz (not symlinked)"
+ NEXTLINE=0
+ FINDVERSION=""
+ for I in `file /boot/vmlinuz-linux`; do
+ if [ ${NEXTLINE} -eq 1 ]; then
+ FINDVERSION="${I}"
+ else
+ # Searching for the Linux kernel after the keyword 'version'
+ if [ "${I}" = "version" ]; then NEXTLINE=1; fi
+ fi
+ done
+ if [ ! "${FINDVERSION}" = "" ]; then
+ CURRENT_KERNEL=`uname -r`
+ if [ ! "${CURRENT_KERNEL}" = "${FINDVERSION}" ]; then
+ logtext "Result: reboot needed, as current kernel is different than the one loaded"
+ REBOOT_NEEDED=1
+ fi
+ else
+ ReportException "${TEST_NO}:1" "Can't determine kernel version on disk, need debug data"
+ fi
elif [ -f /boot/vmlinuz-linux ]; then
logtext "Result: /found /boot/vmlinuz-linux (usually Arch Linux or similar)"
logtext "Test: checking kernel version on disk"