Offer to reboot at the end of an install or update that needs one
shellcheck / shellcheck (push) Failing after 13s
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:
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Purpose : The end of install.sh: say the install worked, say whether to
|
||||
# reboot, and offer configure if something is still to do. refresh
|
||||
# reboot and offer to, and offer configure if something is still to do. refresh
|
||||
# runs install.sh too, so it may all be done already; the install
|
||||
# still ends by saying it worked, so it can't be taken for a failure.
|
||||
|
||||
@@ -19,6 +19,12 @@ echo -e "\e[32mCoreDesktop is installed.\e[0m"
|
||||
if [ ! -d "/usr/lib/modules/$(uname -r)" ]; then
|
||||
echo "A newer kernel has been installed. Reboot, then run: configure"
|
||||
echo "$CONFIGURE_HINT"
|
||||
# The same as the system menu's restart: an active desktop session needs no password
|
||||
if { : < "$TTY"; } 2> /dev/null && read -rp "Reboot now? [y/N] " answer < "$TTY" \
|
||||
&& [[ "$answer" == [yY]* ]]; then
|
||||
echo "Rebooting..."
|
||||
systemctl reboot || echo "Couldn't reboot. Restart from the system menu instead."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
echo "Kernel is up to date, no reboot needed. You may want to consider a reboot if other significant software was updated or installed."
|
||||
|
||||
Reference in New Issue
Block a user