Point npm, PyPI, Go, Rust, RubyGems and Maven at China mirrors on China machines

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 00:28:00 -04:00
1 parent da6045be3f
commit 151a530d15
7 files changed
+75 -5

No files matched your search

+28 -4
View File
@@ -66,11 +66,13 @@ 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"
root="$test_tmp/root"
sed -e "s|/etc/|$root/etc/|g" -e "s| /\.cargo/| $root/.cargo/|g" "$ROOT/install/config/region.sh" >"$region_setup"
export OMARCHY_PATH="$ROOT"
: >"$calls"
OMARCHY_REGION=china bash -e "$region_setup"
[[ $(<"$test_tmp/etc-omarchy/region") == "china" ]] || fail "install records the China region"
[[ $(<"$root/etc/omarchy/region") == "china" ]] || fail "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
@@ -78,13 +80,35 @@ for package in fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer;
done
pass "install records the China region and installs the Rime packages the ISO carries"
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"
done
pass "China links the developer mirror drop-ins"
: >"$calls"
OMARCHY_REGION=global bash -e "$region_setup"
[[ ! -e $test_tmp/etc-omarchy/region ]] || fail "install records Global by leaving no region file"
[[ ! -e $root/etc/omarchy/region ]] || fail "install records Global by leaving no region file"
[[ ! -s $calls ]] || fail "Global installs no input method packages" "$(<"$calls")"
[[ ! -e $root/etc/environment.d/90-omarchy-china.conf && ! -e $root/.cargo/config.toml && ! -e $root/etc/gemrc ]] ||
fail "Global removes the developer mirror drop-ins"
pass "Global removes the developer mirror drop-ins"
ln -s /usr/share/somewhere/gemrc "$root/etc/gemrc"
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
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: []" ]] ||
fail "China names the file it refuses to replace and leaves it" "$output"
rm "$root/etc/gemrc"
pass "region setup never touches mirror config Omarchy did not create"
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"
[[ ! -e $root/etc/omarchy/region ]] || fail "an installer that passes no region installs Global"
pass "Global and an unset region leave no region file"
if output=$(OMARCHY_REGION=mars bash -e "$region_setup" 2>&1); then