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.
This commit is contained in:
David Prevot 2023-12-13 17:04:04 +01:00
parent f64176db21
commit ff5f7ec399

View file

@ -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"