When updating the xen hypervisor, touch the /run/reboot-required file to
indicate a reboot is required. Also add information about the package
requesting the reboot to the /run/reboot-required.pkgs file.
Closes: #862408
Signed-off-by: Maximilian Engelhardt <maxi@daemonizer.de>
Reviewed-by: Hans van Kranenburg <hans@knorrie.org>
if command -v update-grub > /dev/null && [ -d /boot/grub ]; then
update-grub || :
fi
+
+ # create or update /run/reboot-required{,.pkgs} if xen hypervisor is
+ # running
+ if [ -e "/sys/hypervisor/type" ]; then
+ type="$(cat /sys/hypervisor/type)"
+ if [ "$type" = xen ]; then
+ if [ -d /run ]; then
+ touch /run/reboot-required
+ if ! grep -q "^$DPKG_MAINTSCRIPT_PACKAGE$" /run/reboot-required.pkgs 2> /dev/null ; then
+ echo "$DPKG_MAINTSCRIPT_PACKAGE" >> /run/reboot-required.pkgs
+ fi
+ fi
+ fi
+ fi
;;
abort-upgrade|abort-remove|abort-deconfigure)