From 4eafef502557e8c0384f68c3d3b90b3d3ecd0fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Tue, 6 Oct 2026 01:02:03 -0400 Subject: [PATCH] Correct the China docs and move .cn twins in the rc repository migration --- AGENTS.md | 2 +- docs/update-process.md | 2 +- manual/52-china.md | 8 ++++---- migrations/1788112314.sh | 2 +- test/shell.d/region-switch-test.sh | 10 ++++++++++ 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 1f5dcb25..856351d9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -100,7 +100,7 @@ Exceptions are allowed for migration and package-helper scripts where the helper - `/etc/omarchy/region` holds `china`; no file means Global. `omarchy-region` prints the region and switches it (`omarchy region china|global`); user-facing docs live in `manual/52-china.md`. - `install/config/region.sh` is the one system leaf for both the ISO install (`OMARCHY_REGION`, from the configurator's `omarchy_install.region`) and the runtime switch: region file, the `default/region/china/` drop-ins it symlinks, the Rime packages, and the locale. `install/user/region.sh` runs `rime-ice-installer --asset-dir /opt/packages/rime-ice` only in the `iso-chroot` context, where the ISO bundles that data. -- `default/region/china/pacman.sed` puts a `.omarchy.cn` twin ahead of every `.omarchy.org` server; `omarchy-refresh-pacman`, `install/post-install/pacman.sh` and `omarchy-region` apply it. Nothing in `omarchy update` or migrations may rewrite the region, the mirrors or `/etc/locale.conf`. +- `default/region/china/pacman.sed` puts a `.omarchy.cn` twin ahead of every `.omarchy.org` server; `omarchy-refresh-pacman`, `install/post-install/pacman.sh` and `omarchy-region` apply it. Nothing in `omarchy update` or migrations may change the region or `/etc/locale.conf`, and a migration that edits an `.omarchy.org` `Server` line must edit its `.cn` twin the same way. - China-only menu rows carry `"when":"[[ \"$(omarchy-region)\" == \"China\" ]]"` on every row, not only the submenu, because search checks each row's own guard. - Chinese menu labels live in `default/omarchy/omarchy-menu.zh-cn.jsonc`, merged when `LANG` starts with `zh_CN`; give a new menu row with translatable words a label there. - `rime-ice-installer` is built from `omarchy-pkgs` with `omarchy-offline.patch` until it ships in the Omarchy repo. diff --git a/docs/update-process.md b/docs/update-process.md index 5303a36d..1a72454a 100644 --- a/docs/update-process.md +++ b/docs/update-process.md @@ -279,7 +279,7 @@ There is no version file at runtime. `omarchy-version` derives the version from linked checkout, and `omarchy-version-channel` sniffs the mirrorlist and pacman.conf to answer which channel is active. -On a China machine (`/etc/omarchy/region` holds `china`), `omarchy-refresh-pacman` and the installer's `post-install/pacman.sh` run `default/region/china/pacman.sed` over the copied templates, which puts a `.omarchy.cn` twin ahead of every `.omarchy.org` server. The update itself never rewrites these files, so the twins survive every `omarchy update`. +On a China machine (`/etc/omarchy/region` holds `china`), `omarchy-refresh-pacman` and the installer's `post-install/pacman.sh` run `default/region/china/pacman.sed` over the copied templates, which puts a `.omarchy.cn` twin ahead of every `.omarchy.org` server. The update never recopies these files, and a migration that edits a `Server` line must edit its `.cn` twin the same way, as `1788112314.sh` does, so the twins survive every `omarchy update`. ## Update-related binaries diff --git a/manual/52-china.md b/manual/52-china.md index daacfeb7..a28f9f27 100644 --- a/manual/52-china.md +++ b/manual/52-china.md @@ -1,6 +1,6 @@ # China -Omarchy works out of the box in mainland China without a VPN. Pick _China_ on the first screen of the installer, the region picker that comes before the keyboard layout, and the machine comes up ready: Chinese menus and system language, a Chinese input method, Chinese package mirrors, and the Chinese software people actually need. +Omarchy is built to work in mainland China without a VPN. Pick _China_ on the first screen of the installer, the region picker that comes before the keyboard layout, and the machine comes up ready: Chinese menus and system language, a Chinese input method, Chinese package mirrors, and the Chinese software people actually need. ## What China sets up @@ -14,7 +14,7 @@ Omarchy works out of the box in mainland China without a VPN. Pick _China_ on th Chinese text renders in the right Noto CJK variant everywhere: Simplified for Chinese, Traditional for Taiwan and Hong Kong, Japanese and Korean for those languages. That works in both regions. -Every package mirror lists the `.cn` server first and the `.org` server second. If the `.cn` mirror is unreachable, or a package is missing there, pacman falls through to `.org`, which works for anyone with their own VPN. +Every package mirror lists the `.cn` server first and the `.org` server second. If the `.cn` mirror is unreachable, or a package is missing there, pacman falls through to `.org`, which works for anyone with their own VPN. `pkgs.omarchy.cn` serves the Omarchy packages today; until the Arch mirrors on `stable-mirror.omarchy.cn` and friends come online, Arch packages come from the `.org` servers. ## Input @@ -22,7 +22,7 @@ The installer sets up Rime Ice offline, from data bundled on the ISO, so Chinese ## Developer mirrors -China machines point the common package managers at mirrors inside China through drop-ins Omarchy owns: `/etc/environment.d/90-omarchy-china.conf` (npm, PyPI and uv, Go, rustup, Bundler, Maven), `/.cargo/config.toml` (crates.io) and `/etc/gemrc` (RubyGems). They take effect from your next login. A project's own configuration still wins, and Omarchy never replaces one of those files if you created it yourself. +China machines point the common package managers at mirrors inside China. Environment variables in `/etc/environment.d/90-omarchy-china.conf` cover npm, PyPI and uv, Go, rustup, Bundler and Maven; they reach everything started from the desktop after your next login (not SSH or TTY shells), and they take precedence over npm, pip, uv and Go config files, so unset the variable in a shell to opt out. `/.cargo/config.toml` (crates.io) and `/etc/gemrc` (RubyGems) are system-wide defaults that a project's own config overrides. Omarchy never replaces one of those two files if it is a regular file you created. Toolchain downloads by mise, such as Node.js or Go themselves, still come from upstream. ## China Apps @@ -38,4 +38,4 @@ _Setup > Region_ switches an installed machine either way, or run `omarchy regio Switching to Global moves packages back to the `.org` servers, the language back to English, and removes the developer mirrors, China Apps and the Claude Code API setup. It keeps the input method and the CJK fonts, so you can still type and read Chinese. `omarchy update` never changes the region or the language; only these switches do. -A machine prepared for another owner, or reset to factory settings, keeps its region but doesn't carry the input method's offline data. Pick _Setup > Region > China_ once it's online to set Rime Ice up. +A machine prepared for another owner keeps the region picked in the installer, and a factory reset returns a machine to the region it was installed with. Neither carries the input method's offline data, so pick _Setup > Region > China_ once the machine is online; that setup downloads Rime Ice from GitHub. diff --git a/migrations/1788112314.sh b/migrations/1788112314.sh index 402342ab..2c7070a9 100644 --- a/migrations/1788112314.sh +++ b/migrations/1788112314.sh @@ -7,6 +7,6 @@ echo "Point rc-channel installs at the rc package repository" # shipped pairing: an administrator who chose another combination keeps it. if grep -q "https://rc-mirror.omarchy.org/" /etc/pacman.d/mirrorlist && grep -q "^Server = https://pkgs.omarchy.org/edge/" /etc/pacman.conf; then - sudo sed -i "s|^Server = https://pkgs.omarchy.org/edge/|Server = https://pkgs.omarchy.org/rc/|" /etc/pacman.conf + sudo sed -i -E "s#^Server = https://pkgs\.omarchy\.(org|cn)/edge/#Server = https://pkgs.omarchy.\1/rc/#" /etc/pacman.conf echo "Switched the [omarchy] repository to the rc channel to match this machine's rc mirror." fi diff --git a/test/shell.d/region-switch-test.sh b/test/shell.d/region-switch-test.sh index ed056a01..ecf316e0 100755 --- a/test/shell.d/region-switch-test.sh +++ b/test/shell.d/region-switch-test.sh @@ -66,3 +66,13 @@ if output=$(omarchy-region mars 2>&1); then fail "an unknown region is refused" "$output" fi pass "an unknown region is refused" + +rc_migration="$test_tmp/1788112314.sh" +rewrite "$ROOT/migrations/1788112314.sh" "$rc_migration" +cp "$ROOT/default/pacman/mirrorlist-rc" "$root/etc/pacman.d/mirrorlist" +sed -e 's|pkgs.omarchy.org/rc/|pkgs.omarchy.org/edge/|' "$ROOT/default/pacman/pacman-rc.conf" | + sed -f "$ROOT/default/region/china/pacman.sed" >"$root/etc/pacman.conf" +bash -e "$rc_migration" >/dev/null +[[ $(grep '^Server' "$root/etc/pacman.conf") == $'Server = https://pkgs.omarchy.cn/rc/$arch\nServer = https://pkgs.omarchy.org/rc/$arch' ]] || + fail "the rc repository migration moves the .cn twin with its .org server" "$(grep '^Server' "$root/etc/pacman.conf")" +pass "the rc repository migration moves the .cn twin with its .org server"