From ff5f7ec399043d88fcca52926858055e87b5e08c Mon Sep 17 00:00:00 2001 From: David Prevot Date: Wed, 13 Dec 2023 17:04:04 +0100 Subject: [PATCH] IS_KERNELUPTODATE: Address false positive in case of kernel removal If a kernel is removed, then grub is updated. Try to check the actual kernel files instead of any file in /boot. --- linux/evocheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/evocheck.sh b/linux/evocheck.sh index 685bf1c..92cf81e 100755 --- a/linux/evocheck.sh +++ b/linux/evocheck.sh @@ -683,7 +683,7 @@ check_phpmyadminapacheconf() { check_kerneluptodate() { if is_installed linux-image*; then # shellcheck disable=SC2012 - kernel_installed_at=$(date -d "$(ls --full-time -lcrt /boot | tail -n1 | awk '{print $6}')" +%s) + kernel_installed_at=$(date -d "$(ls --full-time -lcrt /boot/*lin* | tail -n1 | awk '{print $6}')" +%s) last_reboot_at=$(($(date +%s) - $(cut -f1 -d '.' /proc/uptime))) if [ "$kernel_installed_at" -gt "$last_reboot_at" ]; then failed "IS_KERNELUPTODATE" "machine is running an outdated kernel, reboot advised"