Offer to reboot at the end of an install or update that needs one
shellcheck / shellcheck (push) Failing after 13s

update already said "Please reboot when convenient" after a new kernel,
firmware, microcode, NVIDIA driver, systemd or glibc. It now ends by
asking "Reboot now? [y/N]", after the offer to send a failed step's
log. 99-reboot-check.sh records that a reboot is needed, and update
clears that before its steps run, so an earlier update's reboot isn't
offered. Under script(1), the copy outside reboots once the log is
cleaned up. Never asked without a terminal, or when the initramfs
failed to rebuild.

install asks the same when it brought in a newer kernel.

Both reboot with systemctl, like the system menu's restart: sudo's
cached password belongs to another terminal by then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 06:17:53 -07:00
co-authored by Claude Opus 5.5
parent 902967f111
commit 5d7db2cdc8
6 changed files with 157 additions and 4 deletions
+5
View File
@@ -2,6 +2,9 @@
source "$HOME/.local/share/coredesktop/utils.sh"
# Tells update to offer a reboot at the end
REBOOT_NEEDED="$HOME/.local/state/coredesktop/reboot-needed"
# Packages whose upgrade only fully takes effect after a reboot: the kernel and
# firmware, the NVIDIA driver (the loaded module must match the installed
# one), CPU microcode, and the core libraries every running program uses
@@ -31,4 +34,6 @@ fi
if (( ${#reasons[@]} > 0 )); then
reason="$(printf '%s; ' "${reasons[@]}")"
echo -e "\e[33mPlease reboot when convenient to finish this update (${reason%; }).\e[0m"
# update offers to reboot once it's done; it removes this file before its hooks run
mkdir -p "$(dirname "$REBOOT_NEEDED")" && echo "${reason%; }" > "$REBOOT_NEEDED"
fi