d/xen-hypervisor-V-F.postinst.vsn-in: use reboot-required
authorMaximilian Engelhardt <maxi@daemonizer.de>
Mon, 7 Dec 2020 22:54:16 +0000 (23:54 +0100)
committerHans van Kranenburg <hans@knorrie.org>
Fri, 26 Feb 2021 19:10:29 +0000 (20:10 +0100)
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>
debian/xen-hypervisor-V-F.postinst.vsn-in

index 1540842eec95501644c9d1c6b5cef926d8c093a3..623637b057428baf2a23973e66c6a316e8223aa5 100644 (file)
@@ -7,6 +7,20 @@ case "$1" in
         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)