From 32ebf6b85b4b47c6dfb3b32db2ea82e4a120e385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Mon, 5 Oct 2026 23:32:21 -0400 Subject: [PATCH] Set up Rime Ice from the ISO's assets on China installs --- install/config/region.sh | 1 + install/omarchy-other.packages | 8 +++++++ install/user/all.sh | 1 + install/user/region.sh | 9 ++++++++ plans/omarchycn.md | 2 +- test/shell.d/region-test.sh | 39 +++++++++++++++++++++++++++++++++- 6 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 install/user/region.sh diff --git a/install/config/region.sh b/install/config/region.sh index deec32e9..4ed4bc62 100644 --- a/install/config/region.sh +++ b/install/config/region.sh @@ -5,6 +5,7 @@ global) china) mkdir -p /etc/omarchy echo china >/etc/omarchy/region + omarchy-pkg-add fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer ;; *) echo "Unknown OMARCHY_REGION: $OMARCHY_REGION" >&2 diff --git a/install/omarchy-other.packages b/install/omarchy-other.packages index a6e61656..22e78e84 100644 --- a/install/omarchy-other.packages +++ b/install/omarchy-other.packages @@ -72,3 +72,11 @@ t2fanrd # Framework 16 qmk-hid + +# China region input method (install/config/region.sh) +dialog +fcitx5-configtool +fcitx5-rime +librime +opencc +rime-ice-installer diff --git a/install/user/all.sh b/install/user/all.sh index d81c3e75..3f91e8f9 100644 --- a/install/user/all.sh +++ b/install/user/all.sh @@ -13,3 +13,4 @@ run_logged "$OMARCHY_INSTALL/user/hardware/vm-no-animations.sh" run_logged "$OMARCHY_INSTALL/user/default-keyring.sh" run_logged "$OMARCHY_INSTALL/user/mise.sh" +run_logged "$OMARCHY_INSTALL/user/region.sh" diff --git a/install/user/region.sh b/install/user/region.sh new file mode 100644 index 00000000..b9864ad9 --- /dev/null +++ b/install/user/region.sh @@ -0,0 +1,9 @@ +region=$(omarchy-region) + +if [[ $region == "China" ]]; then + if [[ $OMARCHY_SETUP_CONTEXT == "iso-chroot" ]]; then + rime-ice-installer --yes --asset-dir /opt/packages/rime-ice + else + echo "Skipping Rime Ice setup in $OMARCHY_SETUP_CONTEXT: only the ISO bundles its assets" + fi +fi diff --git a/plans/omarchycn.md b/plans/omarchycn.md index cbdfe7ed..90e6388e 100644 --- a/plans/omarchycn.md +++ b/plans/omarchycn.md @@ -15,7 +15,7 @@ Progress source of truth for the `omarchycn` branches of `omarchy`, `omarchy-iso - [x] T0 Branches and this list - [x] T1 China package sources (PRD 1): region state, `omarchy-region` reader, `default/region/china/pacman.sed`, applied by `omarchy-refresh-pacman` and `install/post-install/pacman.sh`; tests -- [ ] T2 Region choice in the installer (PRD 2): `omarchy_prompt_region` in `setup-form.sh`, ISO configurator screen, orchestrator passes `OMARCHY_REGION`, `install/config/region.sh` records it +- [x] T2 Region choice in the installer (PRD 2): `omarchy_prompt_region` in `setup-form.sh`, ISO configurator screen, orchestrator passes `OMARCHY_REGION`, `install/config/region.sh` records it - [ ] T3 Input method (PRD 3): rime-ice-installer patch and PKGBUILD in omarchy-pkgs, IME packages in `omarchy-other.packages`, install-time package add, user step runs the installer from bundled assets, ISO build bundles assets and the package - [ ] T4 CJK fontconfig fix (PRD 4): rebuild PR 9693 on the current base - [ ] T5 AI (PRD 5): Dim and Kimi Code for every region (rebuild PR 9694), Claude Code third-party provider setup shown only in China diff --git a/test/shell.d/region-test.sh b/test/shell.d/region-test.sh index 49399014..ed6e58e3 100755 --- a/test/shell.d/region-test.sh +++ b/test/shell.d/region-test.sh @@ -55,15 +55,33 @@ fi [[ $output == "Unknown region in $region_file: mars" ]] || fail "an unknown region names the file and value" "$output" pass "an unknown region fails and names the file and value" +stub_bin="$test_tmp/bin" +calls="$test_tmp/calls" +mkdir -p "$stub_bin" +for command in omarchy-pkg-add rime-ice-installer; do + printf '#!/bin/bash\necho "%s $*" >>"%s"\n' "$command" "$calls" >"$stub_bin/$command" +done +printf '#!/bin/bash\necho "$STUB_REGION"\n' >"$stub_bin/omarchy-region" +chmod +x "$stub_bin"/* +PATH="$stub_bin:$PATH" + region_setup="$test_tmp/region.sh" sed "s|/etc/omarchy|$test_tmp/etc-omarchy|g" "$ROOT/install/config/region.sh" >"$region_setup" +: >"$calls" OMARCHY_REGION=china bash -e "$region_setup" [[ $(<"$test_tmp/etc-omarchy/region") == "china" ]] || fail "install records the China region" -pass "install records the China region" +[[ $(<"$calls") == "omarchy-pkg-add fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer" ]] || + fail "China installs the Rime input method packages" "$(<"$calls")" +for package in fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer; do + grep -qx "$package" "$ROOT/install/omarchy-other.packages" || fail "the ISO mirror carries $package" +done +pass "install records the China region and installs the Rime packages the ISO carries" +: >"$calls" OMARCHY_REGION=global bash -e "$region_setup" [[ ! -e $test_tmp/etc-omarchy/region ]] || fail "install records Global by leaving no region file" +[[ ! -s $calls ]] || fail "Global installs no input method packages" "$(<"$calls")" OMARCHY_REGION=china bash -e "$region_setup" env -u OMARCHY_REGION bash -e "$region_setup" [[ ! -e $test_tmp/etc-omarchy/region ]] || fail "an installer that passes no region installs Global" @@ -74,3 +92,22 @@ if output=$(OMARCHY_REGION=mars bash -e "$region_setup" 2>&1); then fi [[ $output == "Unknown OMARCHY_REGION: mars" ]] || fail "install names the unknown region" "$output" pass "install rejects an unknown region" + +user_region="$ROOT/install/user/region.sh" + +: >"$calls" +STUB_REGION=China OMARCHY_SETUP_CONTEXT=iso-chroot bash -e "$user_region" +[[ $(<"$calls") == "rime-ice-installer --yes --asset-dir /opt/packages/rime-ice" ]] || + fail "a China install sets up Rime Ice from the ISO's assets" "$(<"$calls")" +pass "a China install sets up Rime Ice from the ISO's assets" + +: >"$calls" +output=$(STUB_REGION=China OMARCHY_SETUP_CONTEXT=provision-owner bash -e "$user_region") +[[ ! -s $calls && $output == "Skipping Rime Ice setup in provision-owner: only the ISO bundles its assets" ]] || + fail "first-boot setup says why it skips Rime Ice" "$output $(<"$calls")" +pass "first-boot setup says why it skips Rime Ice" + +: >"$calls" +output=$(STUB_REGION=Global OMARCHY_SETUP_CONTEXT=iso-chroot bash -e "$user_region") +[[ ! -s $calls && -z $output ]] || fail "a Global install leaves the input method alone" "$output $(<"$calls")" +pass "a Global install leaves the input method alone"