reboot messages
This commit is contained in:
@@ -2,9 +2,33 @@
|
|||||||
|
|
||||||
source "$HOME/.local/share/coredesktop/utils.sh"
|
source "$HOME/.local/share/coredesktop/utils.sh"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
REBOOT_PACKAGES='linux|linux-lts|linux-zen|linux-hardened|linux-firmware.*|nvidia.*|.*-ucode|systemd|glibc'
|
||||||
|
|
||||||
if initramfs_build_failed; then
|
if initramfs_build_failed; then
|
||||||
echo -e "\e[31mDon't reboot yet: the initramfs failed to rebuild (see $PACMAN_UPDATE_LOG).\e[0m"
|
echo -e "\e[31mDon't reboot yet: the initramfs failed to rebuild (see $PACMAN_UPDATE_LOG).\e[0m"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
reasons=()
|
||||||
|
|
||||||
# If the running kernel's modules are gone, a newer kernel was installed
|
# If the running kernel's modules are gone, a newer kernel was installed
|
||||||
elif [ ! -d "/usr/lib/modules/$(uname -r)" ]; then
|
if [ ! -d "/usr/lib/modules/$(uname -r)" ]; then
|
||||||
echo "A newer kernel has been installed. Please reboot when convenient."
|
reasons+=("a newer kernel was installed")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Packages upgraded by this update's pacman -Su (see updates.d/10-pacman.sh)
|
||||||
|
if [ -f "$PACMAN_UPDATE_LOG" ]; then
|
||||||
|
mapfile -t upgraded < <(tr '\r' '\n' < "$PACMAN_UPDATE_LOG" \
|
||||||
|
| grep -oP 'upgrading \K[^ ]+' | sort -u | grep -xE "$REBOOT_PACKAGES")
|
||||||
|
if (( ${#upgraded[@]} > 0 )); then
|
||||||
|
reasons+=("${upgraded[*]} upgraded")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( ${#reasons[@]} > 0 )); then
|
||||||
|
reason="$(printf '%s; ' "${reasons[@]}")"
|
||||||
|
echo -e "\e[33mPlease reboot when convenient to finish this update (${reason%; }).\e[0m"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user