Skip to content

Commit d43352a

Browse files
committed
improve reboot detection
1 parent 0278c56 commit d43352a

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

client/patchman-client

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,13 +713,23 @@ get_repos() {
713713
}
714714

715715
reboot_required() {
716-
# On debian-based clients, the update-notifier-common
717-
# package needs to be installed for this to work.
716+
# Debian/Ubuntu: update-notifier-common sets this file
718717
if [ -e /var/run/reboot-required ] ; then
719718
reboot=True
720-
else
721-
reboot=ServerCheck
719+
return
720+
fi
721+
722+
# Compare running vs installed kernel via /boot/vmlinuz symlink
723+
if [ -e /proc/sys/kernel/osrelease ] && [ -L /boot/vmlinuz ] ; then
724+
running_kernel=$(cat /proc/sys/kernel/osrelease)
725+
installed_kernel=$(readlink /boot/vmlinuz | sed -e 's/^vmlinuz-//')
726+
if [ "${running_kernel}" != "${installed_kernel}" ] ; then
727+
reboot=True
728+
return
729+
fi
722730
fi
731+
732+
reboot=ServerCheck
723733
}
724734

725735
build_packages_json() {

0 commit comments

Comments
 (0)