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:
authorSteve Kolenich <stephen.kolenich@tutanota.com>2020-08-10 19:27:30 +0300
committerSteve Kolenich <stephen.kolenich@tutanota.com>2020-08-10 19:27:30 +0300
commitf65f4d011b88f7e3d16daaabdd851c7ec3c8b08b (patch)
tree22c93c121c7204e92acc7eecbf629fa250cf177c /include/tests_kernel
parentec551d732d52e00cde12ee3d6d85ed699dca0d0e (diff)
Improve detecting kernel version on disk
Improve handling of kenrel files /boot/vmlinuz-linux-lts /boot/vmlinuz-linux /boot/vmlinuz-lts by updateing RegEx and adding elif this corrects issue where version is identified as 'linux' or 'lts' causing false report that a reboot is needed
Diffstat (limited to 'include/tests_kernel')
-rw-r--r--include/tests_kernel5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/tests_kernel b/include/tests_kernel
index 011d02c6..56e7e46f 100644
--- a/include/tests_kernel
+++ b/include/tests_kernel
@@ -664,6 +664,9 @@
elif [ -f ${ROOTDIR}boot/vmlinuz-linux-lts ]; then
LogText "Result: found ${ROOTDIR}boot/vmlinuz-linux-lts"
FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-linux-lts
+ elif [ -f ${ROOTDIR}boot/vmlinuz-lts ]; then
+ LogText "Result: found ${ROOTDIR}boot/vmlinuz-lts"
+ FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-lts
else
# Match on /boot/vm5.3.7 or /boot/vmlinuz-5.3.7-1-default
FOUND_VMLINUZ=$(${LSBINARY} -t ${ROOTDIR}boot/vm[l0-9]* 2> /dev/null | ${HEADBINARY} -1)
@@ -678,7 +681,7 @@
VERSION_ON_DISK=$(echo ${FOUND_VMLINUZ} | ${SEDBINARY} 's#^/boot/##' | ${SEDBINARY} 's/^vmlinuz-//')
LogText "Result: version derived from file name is '${VERSION_ON_DISK}'"
elif [ -f "${FOUND_VMLINUZ}" ]; then
- VERSION_ON_DISK=$(echo ${FOUND_VMLINUZ} | ${SEDBINARY} 's#^/boot/##' | ${SEDBINARY} 's/^vmlinuz-//')
+ VERSION_ON_DISK=$(echo ${FOUND_VMLINUZ} | ${SEDBINARY} 's#^/boot/##' | ${SEDBINARY} 's/^vmlinuz-//' | ${SEDBINARY} '$s/-\?\(linux\)\?-\?\(lts\)\?//')
LogText "Result: version derived from file name is '${VERSION_ON_DISK}'"
fi