Defer channel switch reboot until after update

This commit is contained in:
David Heinemeier Hansson
2026-07-23 14:19:24 -07:00
parent b2f1bb6ae3
commit 347997871e
4 changed files with 141 additions and 14 deletions
+10 -1
View File
@@ -46,6 +46,7 @@ link_dev_checkout() {
dev_checkout=""
channel="$1"
leaving_dev=0
case "$channel" in
stable)
@@ -74,13 +75,21 @@ case "$channel" in
;;
esac
if [[ -z $dev_checkout && $OMARCHY_PATH != "/usr/share/omarchy" ]]; then
leaving_dev=1
fi
omarchy-refresh-pacman "$pacman_channel"
# --ask 4 accepts omarchy <-> omarchy-dev replacement prompts without file overwrites.
sudo env OMARCHY_UPDATE_PACMAN=1 pacman -S --needed --noconfirm --ask 4 "${packages[@]}"
if [[ -z $dev_checkout ]]; then
omarchy-dev-unlink
omarchy-dev-unlink --no-reboot
export OMARCHY_PATH=/usr/share/omarchy
if (( leaving_dev )); then
omarchy-state set reboot-required
fi
fi
omarchy-update -y
+27 -6
View File
@@ -2,6 +2,7 @@
# omarchy:summary=Restore Omarchy to the package install after reboot
# omarchy:group=dev
# omarchy:args=[--no-reboot]
set -euo pipefail
@@ -10,16 +11,36 @@ if (( EUID == 0 )); then
exit 1
fi
if [[ ${1:-} == "-h" || ${1:-} == "--help" ]]; then
cat <<USAGE
Usage: omarchy dev unlink
prompt_reboot=1
if (( $# > 1 )); then
echo "Usage: omarchy dev unlink [--no-reboot]" >&2
exit 1
fi
case "${1:-}" in
"")
;;
--no-reboot)
prompt_reboot=0
;;
-h|--help)
cat <<USAGE
Usage: omarchy dev unlink [--no-reboot]
Writes /etc/omarchy.conf so OMARCHY_PATH resolves to /usr/share/omarchy
after reboot. This intentionally does not rewrite the running Hyprland,
systemd, shell, or app-launcher environment; reboot to make every layer agree.
Use --no-reboot when another command will handle the reboot prompt.
USAGE
exit 0
fi
exit 0
;;
*)
echo "Usage: omarchy dev unlink [--no-reboot]" >&2
exit 1
;;
esac
default_target="/usr/share/omarchy"
@@ -28,6 +49,6 @@ printf 'export OMARCHY_PATH="%s"\n' "$default_target" | sudo tee /etc/omarchy.co
echo "Pointed Omarchy at $default_target"
echo
if gum confirm "Reboot now to activate?"; then
if (( prompt_reboot )) && gum confirm "Reboot now to activate?"; then
omarchy-system-reboot
fi