Files
omarchy/bin/omarchy-update

42 lines
1.2 KiB
Plaintext
Raw Normal View History

2025-06-25 16:47:23 -07:00
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
clear
cat <~/.local/share/omarchy/logo.txt
2025-06-25 16:47:23 -07:00
cd ~/.local/share/omarchy
# Create the migrations state directory, we will store an empty file for each migration that has already been performed.
STATE_DIR="$HOME/.local/state/omarchy/migrations"
mkdir -p "$STATE_DIR"
# Get the latest while trying to preserve any modifications
git pull --autostash
git diff --check || git reset --merge
# Run any pending migrations
for file in migrations/*.sh; do
filename=$(basename "$file")
migrate_at="${filename%.sh}"
# Migration already applied, to re-run it simply delete the state file and try again
[ -e "${STATE_DIR}/$filename" ] && continue
echo -e "\e[32m\nRunning migration (${filename%.sh})\e[0m"
source $file
touch "${STATE_DIR}/$filename"
done
# Update system packages
echo -e "\e[32m\nUpdate system packages\e[0m"
yay -Syu --noconfirm
2025-07-22 19:09:09 -04:00
# 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?" && sudo reboot now
fi
2025-07-22 19:09:09 -04:00
# Back to where we came from
cd - >/dev/null