mirror of
https://github.com/basecamp/omarchy.git
synced 2025-08-03 23:29:23 +00:00
Simplify migrations script
This commit is contained in:
@ -8,19 +8,13 @@ STATE_DIR="$HOME/.local/state/omarchy/migrations"
|
|||||||
mkdir -p "$STATE_DIR"
|
mkdir -p "$STATE_DIR"
|
||||||
|
|
||||||
# Run any pending migrations
|
# Run any pending migrations
|
||||||
cd ~/.local/share/omarchy
|
for file in ~/.local/share/omarchy/migrations/*.sh; do
|
||||||
|
|
||||||
for file in migrations/*.sh; do
|
|
||||||
filename=$(basename "$file")
|
filename=$(basename "$file")
|
||||||
migrate_at="${filename%.sh}"
|
|
||||||
|
|
||||||
# Migration already applied, to re-run it simply delete the state file and try again
|
# Migration already applied, to re-run it simply delete the state file and try again
|
||||||
[ -e "${STATE_DIR}/$filename" ] && continue
|
if [[ ! -f "$STATE_DIR/$filename" ]]; then
|
||||||
|
|
||||||
echo -e "\e[32m\nRunning migration (${filename%.sh})\e[0m"
|
echo -e "\e[32m\nRunning migration (${filename%.sh})\e[0m"
|
||||||
source $file
|
source $file
|
||||||
touch "${STATE_DIR}/$filename"
|
touch "$STATE_DIR/$filename"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Back to where we came from
|
|
||||||
cd - >/dev/null
|
|
||||||
|
Reference in New Issue
Block a user