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:
authorMichael Boelen <michael.boelen@cisofy.com>2020-10-17 14:40:09 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2020-10-17 14:40:09 +0300
commit61c6d5df8d156cdbfc670c3f641db06aa1b761db (patch)
treeb8620cda4f05e913ce0499b6a349e3c01b58e8f9 /include/tests_ports_packages
parent577a8b201fbe03f19e6d04a2c5e2538f624eefc8 (diff)
[PKGS-7410] Don't show exception if no kernels were found on the disk
Diffstat (limited to 'include/tests_ports_packages')
-rw-r--r--include/tests_ports_packages16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/tests_ports_packages b/include/tests_ports_packages
index 286da608..e1071474 100644
--- a/include/tests_ports_packages
+++ b/include/tests_ports_packages
@@ -1289,7 +1289,7 @@
KERNELS=$(${ZYPPERBINARY} --non-interactive -n se --type package --match-exact --installed-only "kernel-default" 2> /dev/null | ${GREPBINARY} "kernel-default" | ${WCBINARY} -l)
if [ ${KERNELS} -eq 0 ]; then
LogText "Result: found no kernels from zypper output, which is unexpected."
- ReportException "KRNL-5840:3" "Could not find any kernel packages via package manager. Maybe using a different kernel package?"
+ ReportException "${TEST_NO}" "Could not find any kernel packages via package manager. Maybe using a different kernel package?"
elif [ ${KERNELS} -gt 3 ]; then
LogText "Result: found more than 5 kernel packages on the system, which might indicate lack of regular cleanups"
ReportSuggestion "${TEST_NO}" "Remove any unneeded kernel packages"
@@ -1299,7 +1299,19 @@
fi
if [ ${KERNELS} -eq 0 -a ${TESTED} -eq 1 ]; then
- ReportException "KRNL-5840:1" "Could not find any kernel packages via package manager"
+ # Only report exception if there are kernels actually there. For example, LXC use the kernel of host system
+ case "${OS}" in
+ "Linux")
+ if [ -d "${ROOTDIR}boot" ]; then
+ if [ -z "$(${FINDBINARY} /boot -maxdepth 1 -type f -name 'vmlinuz*' -print -quit)" ]; then
+ ReportException "${TEST_NO}" "Could not find any kernel packages via package manager"
+ fi
+ fi
+ ;;
+ *)
+ ReportException "${TEST_NO}" "Could not find any kernel packages via package manager"
+ ;;
+ esac
fi
Report "installed_kernel_packages=${KERNELS}"