omarchy/bin/omarchy-update
Ryan Hughes b2eb1b08a4
Add ~/.local/share/omarchy/bin to systemwide PATH (#602)
* Add omarchy to system path

* Remove unnecessary duplicate

* Remove path def since it's global now

* Migration for system-wide path

* Remove debug code

* Refresh after update

* Add common state script

* Restart on state detected

* Set state instead

* Export own path for menu
2025-08-10 19:58:44 +02:00

27 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Get the latest while trying to preserve any modifications
echo -e "\e[32mUpdate Omarchy\e[0m"
omarchy_path=~/.local/share/omarchy
git -C $omarchy_path pull --autostash
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
# 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 "Linux kernel has been updated. Reboot?" && omarchy-state clear re*-required && sudo reboot now
elif [ -f "$HOME/.local/state/omarchy/restart-required" ]; then
gum confirm "Some updates require a system restart to take effect. Would you like to restart now?" && omarchy-state clear re*-required && uwsm stop
elif [ -f "$HOME/.local/state/omarchy/relaunch-required" ]; then
gum confirm "Some updates require Hyprland to be relaunched to take effect. Would you like to relaunch Hyprland now?" && omarchy-state clear relaunch-required && uwsm stop
fi