How to determine if installing updates will require a reboot? [duplicate]

I often install packages and updates for them, although sometimes it is not convenient to do a reboot if one of the packages needs it, so is there any way of telling BEFORE installing the package/update whether or not it will require you to do a reboot? I have already looked here and the solutions there don't solve my problem, nor the more or less same one described there.


There's no flag of sorts on packages that indicate that a reboot is required if the package is installed or updated. So, short answer: you can't.

However, you could extract the .deb files of the package before installing or updating to see if a reboot notification is made in the DEBIAN/postinst script. For example, the postinst script in the linux-image-*.deb packages execute the /usr/share/update-notifier/notify-reboot-required script, which in turn creates the /var/run/reboot-required file. Other postinst scripts may use the same method to indicate a necessary reboot, but there's no enforcement of a default method of getting to the creation of the /var/run/reboot-required file. It might be that a package is maintained by someone who isn't really into doing things like other maintainers do, and decides that the reboot notification can also be done in another script, like DEBIAN/preinst. So, long answer: you can, but it'll be a real nightmare to implement and maintain a way to detect all possible reboot notifications.