2025-06-25 16:47:23 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
cd ~/.local/share/omarchy
|
2025-06-28 11:46:28 -07:00
|
|
|
|
2025-06-29 12:49:51 -07:00
|
|
|
if [[ $1 == "all" ]]; then
|
2025-07-20 15:55:22 -07:00
|
|
|
# Run all migrations since the root commit
|
|
|
|
migration_starting_point=$(git log --max-parents=0 --first-parent --format="%H")
|
2025-06-29 12:49:51 -07:00
|
|
|
else
|
2025-07-20 15:55:22 -07:00
|
|
|
# Remember the commit we're at before upgrading in order to only run new migrations
|
|
|
|
migration_starting_point=$(git log -1 --format=%H)
|
2025-06-29 12:49:51 -07:00
|
|
|
fi
|
2025-06-28 11:46:28 -07:00
|
|
|
|
2025-07-17 09:39:31 -07:00
|
|
|
# Get the latest while trying to preserve any modifications
|
2025-07-17 19:13:35 -07:00
|
|
|
git pull --autostash
|
2025-07-17 23:06:25 -07:00
|
|
|
git diff --check || git reset --merge
|
2025-06-28 11:46:28 -07:00
|
|
|
|
|
|
|
# Run any pending migrations
|
2025-07-20 15:55:22 -07:00
|
|
|
for file in $(git diff --name-only --diff-filter=A $migration_starting_point.. migrations/*.sh); do
|
2025-06-28 11:46:28 -07:00
|
|
|
filename=$(basename "$file")
|
|
|
|
migrate_at="${filename%.sh}"
|
|
|
|
|
2025-07-20 15:55:22 -07:00
|
|
|
echo -e "\e[32m\nRunning migration ($migrate_at)\e[0m"
|
|
|
|
source $file
|
2025-06-28 11:46:28 -07:00
|
|
|
done
|
|
|
|
|
|
|
|
# Back to where we came from
|
2025-06-29 12:49:51 -07:00
|
|
|
cd - >/dev/null
|
2025-07-09 18:33:06 -07:00
|
|
|
|
2025-07-17 09:39:42 -07:00
|
|
|
echo -e ""
|
|
|
|
gum confirm "Update system packages too?" && yay -Syu --noconfirm
|