One-click convert between vanilla Omarchy and OmarchyCN

omarchy-cn-convert turns a package-based install into OmarchyCN in one
curl-able run: registry key + [omarchycn] repo, --ask=4 swap onto the
cn-built packages (Chinese menu/bindings and OMARCHY CN branding ride
the settings tree), [omarchy] mirror line, zh_CN locale, fcitx5-rime
seeding, CN Arch mirrors, and a plymouth rebrand, recording pre-state
in /var/lib/omarchycn/convert-state. omarchy-cn-revert restores that
state symmetrically and survives user-removed packages, self-deletion
mid-swap, and cosmetic plymouth failures after the state is cleared.
Checkout installs are refused toward the overlay.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019hLK3wsDuKVAC37GgDqg6H
This commit is contained in:
2026-08-27 18:20:51 -04:00
co-authored by Claude Fable 5
parent c51df9977b
commit f72a48f747
7 changed files with 251 additions and 4 deletions
+12
View File
@@ -109,6 +109,18 @@ printf 'Server = https://pkgs.omarchy.org/stable/$arch\n' > "$tmpconf"
rm -f "$tmpconf"
pass "omarchy mirror guard ignores comments and matches only the exact line"
# Convert/revert bootstrap pair: parse, self-delete guard, no constant drift
for s in omarchy-cn-convert omarchy-cn-revert; do
bash -n "$ROOT/bin/$s" || fail "$s parses"
grep -q '^main "\$@"$' "$ROOT/bin/$s" || fail "$s wraps work in main() against self-deletion"
done
grep -q -- '--ask=4' "$ROOT/bin/omarchy-cn-convert" || fail "convert auto-confirms the conflict swap"
lib_mirror=$(grep -m1 '^CN_OMARCHY_MIRROR=' "$ROOT/cn/lib/mirror.sh" | cut -d'"' -f2)
revert_mirror=$(grep -m1 '^MIRROR_LINE=' "$ROOT/bin/omarchy-cn-revert" | cut -d'"' -f2)
[[ "Server = $lib_mirror" == "$revert_mirror" ]] ||
fail "revert MIRROR_LINE drifted from cn/lib/mirror.sh" "$revert_mirror"
pass "convert/revert pair: parse, main() guard, ask=4, mirror constant in sync"
# Menu: OmarchyCN entries parse and reference only existing commands
node -e '
const fs = require("fs");