Updates routinely replace the shell's QML, and a stale process can lazy-load new files into old code. Restarting at the end of every omarchy update removes the need for migrations to restart the shell or defer one with the restart-shell-required marker: the login-time migration path already runs a fresh shell that hot-reloads shell.json. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
51 lines
1.5 KiB
Bash
Executable File
51 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Prompt for required reboot or service restarts after updates
|
|
|
|
echo
|
|
|
|
confirm_reboot() {
|
|
gum confirm "$1" && { omarchy-system-reboot; exit 0; }
|
|
}
|
|
|
|
running_kernel=$(uname -r)
|
|
kernel_updated=true
|
|
|
|
for kernel in /usr/lib/modules/*/vmlinuz; do
|
|
if [[ -f $kernel ]] && pacman -Qo "$kernel" &>/dev/null; then
|
|
installed_kernel=$(basename "$(dirname "$kernel")")
|
|
|
|
if [[ $installed_kernel == $running_kernel ]]; then
|
|
kernel_updated=false
|
|
break
|
|
fi
|
|
fi
|
|
done
|
|
|
|
if [[ $kernel_updated == "true" ]]; then
|
|
confirm_reboot "Linux kernel has been updated. Reboot?"
|
|
elif [[ -f $HOME/.local/state/omarchy/reboot-required ]]; then
|
|
confirm_reboot "Updates require reboot. Ready?"
|
|
fi
|
|
|
|
running_hyprland=$(readlink /proc/$(pgrep -x Hyprland)/exe 2>/dev/null)
|
|
if [[ $running_hyprland == *"(deleted)"* ]]; then
|
|
confirm_reboot "Hyprland has been updated. Reboot?"
|
|
fi
|
|
|
|
for file in "$HOME"/.local/state/omarchy/restart-*-required; do
|
|
if [[ -f $file ]]; then
|
|
filename=$(basename "$file")
|
|
service=$(echo "$filename" | sed 's/restart-\(.*\)-required/\1/')
|
|
echo "Restarting $service"
|
|
omarchy-state clear "$filename"
|
|
omarchy-restart-"$service"
|
|
fi
|
|
done
|
|
|
|
# Updates routinely replace the shell's QML, and a stale process can lazy-load
|
|
# new files into old code. A restart failure (locked session, ssh, TTY) only
|
|
# prints its reason: the next update or login gets a fresh shell anyway.
|
|
echo "Restarting shell"
|
|
omarchy-restart-shell || true
|