mirror of
https://github.com/basecamp/omarchy.git
synced 2025-08-03 23:29:23 +00:00
Split omarchy-migrate into its own command
So it can be updated independently and apply quicker
This commit is contained in:
26
bin/omarchy-migrate
Executable file
26
bin/omarchy-migrate
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit immediately if a command exits with a non-zero status
|
||||
set -e
|
||||
|
||||
# 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"
|
||||
|
||||
# Run any pending migrations
|
||||
cd ~/.local/share/omarchy
|
||||
|
||||
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
|
||||
|
||||
# Back to where we came from
|
||||
cd - >/dev/null
|
Reference in New Issue
Block a user