Set up China before moving the mirrors so a failed switch leaves the machine Global

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 21:13:37 -04:00
1 parent 09da70c303
commit a3e40cb8b0
4 files changed
+28 -6

No files matched your search

+9
View File
@@ -61,6 +61,7 @@ mkdir -p "$stub_bin"
for command in omarchy-pkg-add rime-ice-installer locale-gen; do
printf '#!/bin/bash\necho "%s $*" >>"%s"\n' "$command" "$calls" >"$stub_bin/$command"
done
printf '#!/bin/bash\necho "omarchy-pkg-add $*" >>"%s"\n[[ -z ${STUB_PKG_FAIL:-} ]]\n' "$calls" >"$stub_bin/omarchy-pkg-add"
printf '#!/bin/bash\necho "$STUB_REGION"\n' >"$stub_bin/omarchy-region"
chmod +x "$stub_bin"/*
PATH="$stub_bin:$PATH"
@@ -115,8 +116,16 @@ if output=$(OMARCHY_REGION=china bash -e "$region_setup" 2>&1); then
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"
[[ ! -e $root/etc/omarchy/region ]] || fail "a refused China switch records no region"
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
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"
env -u OMARCHY_REGION bash -e "$region_setup"
[[ ! -e $root/etc/omarchy/region ]] || fail "an installer that passes no region installs Global"