Update: strict-mode migrations, per-file completion markers
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
+6
-10
@@ -5,7 +5,7 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
MANIFEST="$HOME/.local/state/omarchycn/overlay-manifest"
|
MANIFEST="$HOME/.local/state/omarchycn/overlay-manifest"
|
||||||
MIGRATION_STATE="$HOME/.local/state/omarchycn/last-migration"
|
MIGRATION_DONE_DIR="$HOME/.local/state/omarchycn/migrations-done"
|
||||||
|
|
||||||
if [[ ! -f $MANIFEST ]]; then
|
if [[ ! -f $MANIFEST ]]; then
|
||||||
echo "Not an overlay install (no $MANIFEST)." >&2
|
echo "Not an overlay install (no $MANIFEST)." >&2
|
||||||
@@ -26,20 +26,16 @@ echo "Source: $old -> $new"
|
|||||||
|
|
||||||
"$src/bin/omarchy-cn-install-overlay"
|
"$src/bin/omarchy-cn-install-overlay"
|
||||||
|
|
||||||
# Run migrations newer than the last recorded one, in filename order
|
# Run each not-yet-completed migration in filename order, one marker per file
|
||||||
last=""
|
|
||||||
if [[ -f $MIGRATION_STATE ]]; then
|
|
||||||
last=$(<"$MIGRATION_STATE")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $src/cn/migrations ]]; then
|
if [[ -d $src/cn/migrations ]]; then
|
||||||
|
mkdir -p "$MIGRATION_DONE_DIR"
|
||||||
for m in "$src"/cn/migrations/*.sh; do
|
for m in "$src"/cn/migrations/*.sh; do
|
||||||
[[ -f $m ]] || continue
|
[[ -f $m ]] || continue
|
||||||
name="${m##*/}"
|
name="${m##*/}"
|
||||||
if [[ $name > $last ]]; then
|
if [[ ! -f $MIGRATION_DONE_DIR/$name ]]; then
|
||||||
echo "Migration: $name"
|
echo "Migration: $name"
|
||||||
bash "$m"
|
bash -euo pipefail "$m"
|
||||||
echo "$name" > "$MIGRATION_STATE"
|
touch "$MIGRATION_DONE_DIR/$name"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user