Rebuild .cn twins per server and leave database syncs to omarchy update

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 00:52:28 -04:00
1 parent 5f6c803b21
commit 07d5f49963
2 files changed
+14 -11

No files matched your search

+3 -8
View File
@@ -27,23 +27,18 @@ if [[ $1 != "global" && $1 != "china" ]]; then
fi fi
pacman_files=(/etc/pacman.conf /etc/pacman.d/mirrorlist) pacman_files=(/etc/pacman.conf /etc/pacman.d/mirrorlist)
drop_cn_servers='/^Server = https:\/\/[a-z-]*\.omarchy\.cn\//d'
if [[ $1 == "china" ]]; then if [[ $1 == "china" ]]; then
for file in "${pacman_files[@]}"; do sudo sed -i -e "$drop_cn_servers" -f "$OMARCHY_PATH/default/region/china/pacman.sed" "${pacman_files[@]}"
if ! grep -q '^Server = https://[a-z-]*\.omarchy\.cn/' "$file"; then
sudo sed -i -f "$OMARCHY_PATH/default/region/china/pacman.sed" "$file"
fi
done
echo "Package mirrors -> .cn first, .org after" echo "Package mirrors -> .cn first, .org after"
sudo pacman -Sy
sudo env OMARCHY_REGION=china OMARCHY_PATH="$OMARCHY_PATH" bash -e "$OMARCHY_PATH/install/config/region.sh" sudo env OMARCHY_REGION=china OMARCHY_PATH="$OMARCHY_PATH" bash -e "$OMARCHY_PATH/install/config/region.sh"
if [[ ! -f $HOME/.local/share/fcitx5/rime/rime_ice.schema.yaml ]]; then if [[ ! -f $HOME/.local/share/fcitx5/rime/rime_ice.schema.yaml ]]; then
rime-ice-installer --yes rime-ice-installer --yes
fi fi
else else
sudo sed -i '/^Server = https:\/\/[a-z-]*\.omarchy\.cn\//d' "${pacman_files[@]}" sudo sed -i -e "$drop_cn_servers" "${pacman_files[@]}"
echo "Package mirrors -> .org only" echo "Package mirrors -> .org only"
sudo pacman -Sy
sudo env OMARCHY_REGION=global OMARCHY_PATH="$OMARCHY_PATH" bash -e "$OMARCHY_PATH/install/config/region.sh" sudo env OMARCHY_REGION=global OMARCHY_PATH="$OMARCHY_PATH" bash -e "$OMARCHY_PATH/install/config/region.sh"
omarchy-setup-claude-api --remove omarchy-setup-claude-api --remove
fi fi
+11 -3
View File
@@ -33,8 +33,8 @@ omarchy-region china >/dev/null
[[ $(<"$root/etc/pacman.conf") == "$china_conf" && $(<"$root/etc/pacman.d/mirrorlist") == "$china_mirrors" ]] || [[ $(<"$root/etc/pacman.conf") == "$china_conf" && $(<"$root/etc/pacman.d/mirrorlist") == "$china_mirrors" ]] ||
fail "switching to China lists the .cn mirrors first" fail "switching to China lists the .cn mirrors first"
[[ $(omarchy-region) == "China" && $(<"$root/etc/locale.conf") == "LANG=zh_CN.UTF-8" ]] || fail "switching to China records it and sets the language" [[ $(omarchy-region) == "China" && $(<"$root/etc/locale.conf") == "LANG=zh_CN.UTF-8" ]] || fail "switching to China records it and sets the language"
[[ $(<"$calls") == $'pacman -Sy\nomarchy-pkg-add fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer\nlocale-gen \nrime-ice-installer --yes' ]] || [[ $(<"$calls") == $'omarchy-pkg-add fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer\nlocale-gen \nrime-ice-installer --yes' ]] ||
fail "China syncs the .cn databases before installing Rime, then sets Rime Ice up" "$(<"$calls")" fail "China installs Rime without a partial database sync, then sets Rime Ice up" "$(<"$calls")"
pass "switching to China sets mirrors, language and Rime Ice" pass "switching to China sets mirrors, language and Rime Ice"
: >"$calls" : >"$calls"
@@ -45,12 +45,20 @@ omarchy-region china >/dev/null
grep -q '^rime-ice-installer' "$calls" && fail "an existing Rime Ice setup is not redone" grep -q '^rime-ice-installer' "$calls" && fail "an existing Rime Ice setup is not redone"
pass "switching to China again changes nothing it already did" pass "switching to China again changes nothing it already did"
printf 'Server = https://stable-mirror.omarchy.cn/$repo/os/$arch\nServer = https://stable-mirror.omarchy.org/$repo/os/$arch\nServer = https://mirror.omarchy.org/$repo/os/$arch\n' >"$root/etc/pacman.d/mirrorlist"
omarchy-region china >/dev/null
[[ $(<"$root/etc/pacman.d/mirrorlist") == $'Server = https://stable-mirror.omarchy.cn/$repo/os/$arch\nServer = https://stable-mirror.omarchy.org/$repo/os/$arch\nServer = https://mirror.omarchy.cn/$repo/os/$arch\nServer = https://mirror.omarchy.org/$repo/os/$arch' ]] ||
fail "a partly switched mirrorlist gets every missing .cn twin" "$(<"$root/etc/pacman.d/mirrorlist")"
cp "$ROOT/default/pacman/mirrorlist-stable" "$root/etc/pacman.d/mirrorlist"
sed -i -f "$ROOT/default/region/china/pacman.sed" "$root/etc/pacman.d/mirrorlist"
pass "every .org server ends up with exactly one .cn twin in front"
: >"$calls" : >"$calls"
omarchy-region global >/dev/null omarchy-region global >/dev/null
[[ $(<"$root/etc/pacman.conf") == "$(<"$ROOT/default/pacman/pacman-stable.conf")" && $(<"$root/etc/pacman.d/mirrorlist") == "$(<"$ROOT/default/pacman/mirrorlist-stable")" ]] || [[ $(<"$root/etc/pacman.conf") == "$(<"$ROOT/default/pacman/pacman-stable.conf")" && $(<"$root/etc/pacman.d/mirrorlist") == "$(<"$ROOT/default/pacman/mirrorlist-stable")" ]] ||
fail "switching to Global drops exactly the .cn mirrors" fail "switching to Global drops exactly the .cn mirrors"
[[ $(omarchy-region) == "Global" && $(<"$root/etc/locale.conf") == "LANG=en_US.UTF-8" ]] || fail "switching to Global records it and restores English" [[ $(omarchy-region) == "Global" && $(<"$root/etc/locale.conf") == "LANG=en_US.UTF-8" ]] || fail "switching to Global records it and restores English"
[[ $(<"$calls") == $'pacman -Sy\nomarchy-setup-claude-api --remove' ]] || fail "Global removes the Claude Code third-party API and keeps Rime" "$(<"$calls")" [[ $(<"$calls") == "omarchy-setup-claude-api --remove" ]] || fail "Global removes the Claude Code third-party API and keeps Rime" "$(<"$calls")"
[[ -f $HOME/.local/share/fcitx5/rime/rime_ice.schema.yaml ]] || fail "Global keeps the input method" [[ -f $HOME/.local/share/fcitx5/rime/rime_ice.schema.yaml ]] || fail "Global keeps the input method"
pass "switching to Global restores mirrors and language, keeps Rime, removes the Claude API setup" pass "switching to Global restores mirrors and language, keeps Rime, removes the Claude API setup"