Align the China region to the official cn profile
The region value is cn, the China files live under default/regions/cn/, and omarchy-apply-pacman renders pacman for every caller: the .cn twins of the channel servers first, then .org, USTC and ArchLinuxCN. Switching to China installs and trusts the ArchLinuxCN keyring. A migration renames china to cn and repoints the drop-in links.
This commit is contained in:
1 parent
d2e4a95aed
commit
9a57690e7d
20 files changed
+119
-99
No files matched your search
+10
-10
@@ -7,7 +7,7 @@ source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
|
||||
test_tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$test_tmp"' EXIT
|
||||
|
||||
china_sed="$ROOT/default/region/china/pacman.sed"
|
||||
china_sed="$ROOT/default/regions/cn/pacman/servers.sed"
|
||||
|
||||
expected_stable_omarchy='Server = https://pkgs.omarchy.cn/stable/$arch
|
||||
Server = https://pkgs.omarchy.org/stable/$arch'
|
||||
@@ -44,9 +44,9 @@ chmod +x "$region_bin"
|
||||
[[ $("$region_bin") == "Global" ]] || fail "no region file reads as Global"
|
||||
pass "no region file reads as Global"
|
||||
|
||||
echo china >"$region_file"
|
||||
[[ $("$region_bin") == "China" ]] || fail "china region file reads as China"
|
||||
pass "china region file reads as China"
|
||||
echo cn >"$region_file"
|
||||
[[ $("$region_bin") == "China" ]] || fail "cn region file reads as China"
|
||||
pass "cn region file reads as China"
|
||||
|
||||
echo mars >"$region_file"
|
||||
if output=$("$region_bin" 2>&1); then
|
||||
@@ -75,8 +75,8 @@ printf '#zh_CN.UTF-8 UTF-8\nen_US.UTF-8 UTF-8\n' >"$root/etc/locale.gen"
|
||||
printf 'LANG=en_US.UTF-8\nLC_TIME=en_DK.UTF-8\n' >"$root/etc/locale.conf"
|
||||
|
||||
: >"$calls"
|
||||
OMARCHY_REGION=china bash -e "$region_setup"
|
||||
[[ $(<"$root/etc/omarchy/region") == "china" ]] || fail "install records the China region"
|
||||
OMARCHY_REGION=cn bash -e "$region_setup"
|
||||
[[ $(<"$root/etc/omarchy/region") == "cn" ]] || fail "install records the China region as cn"
|
||||
[[ $(<"$calls") == $'omarchy-pkg-add fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer\nlocale-gen ' ]] ||
|
||||
fail "China installs the Rime input method packages and generates the Chinese locale" "$(<"$calls")"
|
||||
[[ $(<"$root/etc/locale.gen") == $'zh_CN.UTF-8 UTF-8\nen_US.UTF-8 UTF-8' ]] || fail "China enables zh_CN in locale.gen"
|
||||
@@ -88,7 +88,7 @@ pass "install records the China region and installs the Rime packages the ISO ca
|
||||
|
||||
for link in "environment.conf etc/environment.d/90-omarchy-china.conf" "cargo.toml .cargo/config.toml" "gemrc etc/gemrc"; do
|
||||
read -r source target <<<"$link"
|
||||
[[ $(readlink "$root/$target") == "$ROOT/default/region/china/$source" ]] || fail "China links /$target to the shipped $source"
|
||||
[[ $(readlink "$root/$target") == "$ROOT/default/regions/cn/$source" ]] || fail "China links /$target to the shipped $source"
|
||||
done
|
||||
pass "China links the developer mirror drop-ins"
|
||||
|
||||
@@ -111,7 +111,7 @@ OMARCHY_REGION=global bash -e "$region_setup"
|
||||
[[ -L $root/etc/gemrc ]] || fail "Global keeps a gemrc link Omarchy did not create"
|
||||
rm "$root/etc/gemrc"
|
||||
echo ":sources: []" >"$root/etc/gemrc"
|
||||
if output=$(OMARCHY_REGION=china bash -e "$region_setup" 2>&1); then
|
||||
if output=$(OMARCHY_REGION=cn bash -e "$region_setup" 2>&1); then
|
||||
fail "China refuses to replace an admin's /etc/gemrc" "$output"
|
||||
fi
|
||||
[[ $output == "Refusing to replace $root/etc/gemrc, which Omarchy did not create" && $(<"$root/etc/gemrc") == ":sources: []" ]] ||
|
||||
@@ -120,13 +120,13 @@ fi
|
||||
rm "$root/etc/gemrc"
|
||||
pass "region setup never touches mirror config Omarchy did not create"
|
||||
|
||||
if output=$(STUB_PKG_FAIL=1 OMARCHY_REGION=china bash -e "$region_setup" 2>&1); then
|
||||
if output=$(STUB_PKG_FAIL=1 OMARCHY_REGION=cn bash -e "$region_setup" 2>&1); then
|
||||
fail "China fails when its packages do not install" "$output"
|
||||
fi
|
||||
[[ ! -e $root/etc/omarchy/region && ! -e $root/etc/gemrc && $(<"$root/etc/locale.conf") == "LANG=en_US.UTF-8" ]] ||
|
||||
fail "a failed package install leaves the machine Global"
|
||||
pass "China installs its packages before it writes any region state"
|
||||
OMARCHY_REGION=china bash -e "$region_setup"
|
||||
OMARCHY_REGION=cn bash -e "$region_setup"
|
||||
env -u OMARCHY_REGION bash -e "$region_setup"
|
||||
[[ ! -e $root/etc/omarchy/region ]] || fail "an installer that passes no region installs Global"
|
||||
pass "Global and an unset region leave no region file"
|
||||
|
||||
Reference in new issue
Block a user