From f4d5fa401377e82403dab1b92bcbebf39628cf50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 28 Aug 2026 13:35:25 -0400 Subject: [PATCH] Run cn migrations in the update pipeline and serve package installs from omarchy cn update Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01Kb7vDj6PHwymeDeSUUk1eX --- AGENTS.md | 4 ++-- bin/omarchy-cn-migrate | 21 +++++++++++++++++++++ bin/omarchy-cn-update | 24 +++++++----------------- bin/omarchy-update | 1 + default/omarchy/omarchy-menu.jsonc | 2 +- 5 files changed, 32 insertions(+), 20 deletions(-) create mode 100755 bin/omarchy-cn-migrate diff --git a/AGENTS.md b/AGENTS.md index 76d5d529..46e268c8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -18,7 +18,7 @@ This fork carries the OmarchyCN China-integration layer on top of upstream `base - `bin/omarchycn` routes to `omarchy cn `; all cn commands are `bin/omarchy-cn-*` and follow the upstream bin conventions (metadata, helpers, `$OMARCHY_PATH` — bootstrap exceptions: the overlay installer resolves its own checkout, and `omarchy-cn-convert` / `omarchy-cn-revert` are curl-able standalone scripts that default `OMARCHY_PATH` because they run before/while the cn tree exists) - Convert/revert: `omarchy-cn-convert` turns a vanilla package-based Omarchy into OmarchyCN (registry key + [omarchycn] repo, `--ask=4` package swap to the cn-built omarchy-dev/omarchy-settings-dev published by `packages/publish-cn-packages.sh`, [omarchy] mirror line, zh_CN locale, fcitx5 seeding, plymouth rebrand) recording pre-state in `/var/lib/omarchycn/convert-state`; `omarchy-cn-revert` restores that state; checkout installs are refused toward the overlay - `cn/` holds the data layer: `mirrors.json`, `dev-mirrors.json`, `apps.json`, `registry/` (AI providers/harnesses/compatibility), `fcitx5/`, `fontconfig/`, `keys/`, `lib/` (sourced helpers), `release` (cn release number) -- cn migrations live in `cn/migrations/*.sh`, run by `omarchy-cn-update` with per-file completion markers under `~/.local/state/omarchycn/` +- cn migrations live in `cn/migrations/*.sh`, run by `omarchy-cn-migrate` with per-file completion markers under `~/.local/state/omarchycn/`; the update pipeline (`bin/omarchy-update`) calls it after `omarchy-migrate`, and `omarchy-cn-update` serves both install forms (overlay: git pull + reinstall + migrate; package: exec `omarchy-update`) - Packaging: `packages/omarchy-pkgs-cn.patch` must be applied to the sibling `omarchy-pkgs` checkout so `omarchy-dev` ships `cn/`; keyring in `packages/omarchycn-keyring/` - Upstream repo mirror: `packages/sync-omarchy-repo.sh` + `.gitea/workflows/pkg-repo-sync.yml` mirror the upstream `[omarchy]` stable channel into the Gitea Arch registry every 6h; `pacman-stable.conf` lists the mirror first (upstream fallback), clients must trust the registry key (install import + cn migration), `omarchycn doctor mirror --fix` re-heals the line; see `docs/pacman-repo.md` - ISO: `packages/omarchy-iso-cn.patch` must be applied to the sibling `omarchy-iso` checkout — Chinese installer (cage+foot graphical console with English VT fallback) and live-env packages @@ -27,7 +27,7 @@ This fork carries the OmarchyCN China-integration layer on top of upstream `base - Chinese-first defaults: OmarchyCN ships Simplified Chinese as the default UX. User-visible strings in `default/omarchy/omarchy-menu.jsonc` (all labels), `default/hypr/bindings/*.lua` (bind descriptions, including the generated workspace/group/panel loops), `bin/omarchy-menu-keybindings` (its merge list and priority patterns must match the shipped Chinese descriptions), `bin/omarchy-update-confirm`, and `install/user/first-run/*` notifications are Chinese with brand names kept in English; menu search stays reachable in English through leaf ids. When syncing upstream, translate new strings in these files and resolve string conflicts toward our Chinese text. - Default set changes vs upstream: `install/omarchy-base.packages` adds fcitx5-rime/chinese-addons/configtool and drops aether/libreoffice-fresh/obs-studio; the Basecamp/Discord/HEY/Google/WhatsApp/X launchers, their webapp keybindings, the whatsapp-slim extension, and the HEY mailto handler are removed (preinstall add/remove lists, launcher.hides, chromium flags, and mimeapps stay in sync); `install/user/cn-chinese.sh` seeds IME/font config on zh_CN systems - AI: `cn/registry/` drives providers (DeepSeek/Kimi/Z.AI/MiniMax/Ollama-local) with zero-code adapters; Ollama uses a fixed `static_token` and runtime-listed models (`models_dynamic`); `omarchy-default-agent` also accepts kimi (official installer script, not mise), deepcode, dim, and dsh (mise npm); the Default Agent menu carries them plus an AI Hub combo entry -- Upstream sync: `.gitea/workflows/upstream-sync.yml` opens a PR per upstream change; keep upstream file edits minimal and inventoried (currently: one `GROUP_DESCRIPTIONS[cn]` line in `bin/omarchy`, the localized menu/bindings/update/first-run surfaces above, the western-app removals above, the cn agent roster in `bin/omarchy-default-agent` / `bin/omarchy-agent` (kimi/deepcode/dim/dsh), the `[omarchy]` mirror line in `default/pacman/pacman-stable.conf`, the registry-key import in `install/post-install/pacman.sh`, a rewritten `README.md` (known recurring sync conflict, resolve toward ours), `AGENTS.md` additions, and two `.gitignore` lines) +- Upstream sync: `.gitea/workflows/upstream-sync.yml` opens a PR per upstream change; keep upstream file edits minimal and inventoried (currently: one `GROUP_DESCRIPTIONS[cn]` line in `bin/omarchy`, the `omarchy-cn-migrate` line in `bin/omarchy-update`, the localized menu/bindings/update/first-run surfaces above, the western-app removals above, the cn agent roster in `bin/omarchy-default-agent` / `bin/omarchy-agent` (kimi/deepcode/dim/dsh), the `[omarchy]` mirror line in `default/pacman/pacman-stable.conf`, the registry-key import in `install/post-install/pacman.sh`, a rewritten `README.md` (known recurring sync conflict, resolve toward ours), `AGENTS.md` additions, and two `.gitignore` lines) - cn tests: `test/shell.d/omarchycn-test.sh`, `test/shell.d/omarchycn-ai-test.sh`; localized UI expectations live in the upstream suites (menu, keybindings-menu, hyprland-default-config, binding-conflicts, clock, screenrecording, update-disk-space) # Documentation Layout diff --git a/bin/omarchy-cn-migrate b/bin/omarchy-cn-migrate new file mode 100755 index 00000000..60166a0c --- /dev/null +++ b/bin/omarchy-cn-migrate @@ -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 diff --git a/bin/omarchy-cn-update b/bin/omarchy-cn-update index 0c5762f5..53d9c91d 100755 --- a/bin/omarchy-cn-update +++ b/bin/omarchy-cn-update @@ -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))" diff --git a/bin/omarchy-update b/bin/omarchy-update index e71e8086..682fd9f2 100755 --- a/bin/omarchy-update +++ b/bin/omarchy-update @@ -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 diff --git a/default/omarchy/omarchy-menu.jsonc b/default/omarchy/omarchy-menu.jsonc index fa4e16fe..b6443bfa 100644 --- a/default/omarchy/omarchy-menu.jsonc +++ b/default/omarchy/omarchy-menu.jsonc @@ -417,7 +417,7 @@ "omarchycn.diagnostics.doctor": {"icon":"󰨮","label":"系统诊断","action":"omarchy-launch-floating-terminal-with-presentation 'omarchy-cn-doctor all'"}, "omarchycn.diagnostics.mirror-fix": {"icon":"󰇧","label":"镜像修复","action":"omarchy-launch-floating-terminal-with-presentation 'omarchy-cn-doctor mirror --fix'"}, "omarchycn.diagnostics.ime": {"icon":"󰌌","label":"输入法状态","action":"omarchy-launch-floating-terminal-with-presentation omarchy-cn-ime-status"}, - "omarchycn.update": {"icon":"","label":"更新","when":"[[ -f ~/.local/state/omarchycn/overlay-manifest ]]","action":"omarchy-launch-floating-terminal-with-presentation omarchy-cn-update"}, + "omarchycn.update": {"icon":"","label":"更新","action":"omarchy-launch-floating-terminal-with-presentation omarchy-cn-update"}, "omarchycn.revert": {"icon":"󰕍","label":"回退为原版 Omarchy","when":"[[ -f /var/lib/omarchycn/convert-state ]]","action":"omarchy-launch-floating-terminal-with-presentation omarchy-cn-revert"}, "omarchycn.about": {"icon":"","label":"关于","action":"omarchy-launch-floating-terminal-with-presentation omarchy-cn-status"}, }