Run cn migrations in the update pipeline and serve package installs from omarchy cn update

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kb7vDj6PHwymeDeSUUk1eX
This commit is contained in:
2026-08-28 13:35:25 -04:00
co-authored by Claude Fable 5
parent 7d22dc14a5
commit f4d5fa4013
5 changed files with 32 additions and 20 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
# omarchy:summary=Run pending OmarchyCN migrations
# omarchy:examples=omarchycn migrate
set -euo pipefail
MIGRATIONS_DIR="$OMARCHY_PATH/cn/migrations"
DONE_DIR="$HOME/.local/state/omarchycn/migrations-done"
[[ -d $MIGRATIONS_DIR ]] || exit 0
mkdir -p "$DONE_DIR"
for m in "$MIGRATIONS_DIR"/*.sh; do
[[ -f $m ]] || continue
name="${m##*/}"
if [[ ! -f $DONE_DIR/$name ]]; then
echo "OmarchyCN migration: $name"
bash -euo pipefail "$m"
touch "$DONE_DIR/$name"
fi
done
+7 -17
View File
@@ -1,15 +1,17 @@
#!/bin/bash
# omarchy:summary=Update an overlay install: pull source, reinstall, run migrations
# omarchy:summary=Full OmarchyCN update: system, cn data, and migrations
# omarchy:examples=omarchycn update
set -euo pipefail
MANIFEST="$HOME/.local/state/omarchycn/overlay-manifest"
MIGRATION_DONE_DIR="$HOME/.local/state/omarchycn/migrations-done"
if [[ ! -f $MANIFEST ]]; then
echo "Not an overlay install (no $MANIFEST)." >&2
echo "Package-based installs update through 'omarchy update' / pacman." >&2
# Package install: the pipeline brings the new cn tree and runs cn migrations
if [[ -d $OMARCHY_PATH/cn ]]; then
exec omarchy-update
fi
echo "未检测到 OmarchyCN$OMARCHY_PATH/cn 不存在,也没有 overlay manifest" >&2
exit 1
fi
@@ -65,18 +67,6 @@ echo "Channel: $channel, source: $old -> $new"
"$src/bin/omarchy-cn-install-overlay"
# Run each not-yet-completed migration in filename order, one marker per file
if [[ -d $src/cn/migrations ]]; then
mkdir -p "$MIGRATION_DONE_DIR"
for m in "$src"/cn/migrations/*.sh; do
[[ -f $m ]] || continue
name="${m##*/}"
if [[ ! -f $MIGRATION_DONE_DIR/$name ]]; then
echo "Migration: $name"
bash -euo pipefail "$m"
touch "$MIGRATION_DONE_DIR/$name"
fi
done
fi
"$src/bin/omarchy-cn-migrate"
echo "OmarchyCN update complete ($(omarchy-cn-version 2>/dev/null || echo unknown))"
+1
View File
@@ -46,6 +46,7 @@ if [[ ${1:-} == "-y" ]] || omarchy-update-confirm; then
# takes the update with it rather than migrating against what is still on disk.
omarchy-update-system-pkgs
omarchy-migrate
omarchy-cn-migrate
omarchy-hook post-update
omarchy-update-aur-pkgs
omarchy-update-mise