Break-out omarchy-update so we can update each step independently and have changes apply to the active update

This commit is contained in:
David Heinemeier Hansson 2025-08-10 20:23:29 +02:00
parent a23a48594f
commit d9d847fd71
4 changed files with 23 additions and 23 deletions

View File

@ -1,27 +1,8 @@
#!/bin/bash #!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e set -e
# Get the latest while trying to preserve any modifications omarchy-update-git
echo -e "\e[32mUpdate Omarchy\e[0m" omarchy-migrate
omarchy_path=~/.local/share/omarchy omarchy-update-system-pkgs
git -C $omarchy_path pull --autostash omarchy-update-restart
git -C $omarchy_path diff --check || git -C $omarchy_path reset --merge
# Run migrations
~/.local/share/omarchy/bin/omarchy-migrate
# Update system packages
echo -e "\e[32m\nUpdate system packages\e[0m"
yay -Syu --noconfirm
echo
# Offer to reboot if the kernel has been changed
if [ "$(uname -r | sed 's/-arch/\.arch/')" != "$(pacman -Q linux | awk '{print $2}')" ]; then
gum confirm "New Linux kernel requires reboot. Ready?" && omarchy-state clear re*-required && sudo reboot now
elif [ -f "$HOME/.local/state/omarchy/reboot-required" ]; then
gum confirm "Updates require reboot. Ready?" && omarchy-state clear re*-required && sudo reboot now
elif [ -f "$HOME/.local/state/omarchy/relaunch-required" ]; then
gum confirm "Updates require Hyprland relaunch. Ready?" && omarchy-state clear relaunch-required && uwsm stop
fi

5
bin/omarchy-update-git Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo -e "\e[32mUpdate Omarchy\e[0m"
git -C $OMARCHY_PATH pull --autostash
git -C $OMARCHY_PATH diff --check || git -C $OMARCHY_PATH reset --merge

9
bin/omarchy-update-restart Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
if [ "$(uname -r | sed 's/-arch/\.arch/')" != "$(pacman -Q linux | awk '{print $2}')" ]; then
gum confirm "New Linux kernel requires reboot. Ready?" && omarchy-state clear re*-required && sudo reboot now
elif [ -f "$HOME/.local/state/omarchy/reboot-required" ]; then
gum confirm "Updates require reboot. Ready?" && omarchy-state clear re*-required && sudo reboot now
elif [ -f "$HOME/.local/state/omarchy/relaunch-required" ]; then
gum confirm "Updates require Hyprland relaunch. Ready?" && omarchy-state clear relaunch-required && uwsm stop
fi

5
bin/omarchy-update-system-pkgs Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo -e "\e[32m\nUpdate system packages\e[0m"
yay -Syu --noconfirm
echo