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

+8
View File
@@ -17,6 +17,7 @@ rewrite "$ROOT/bin/omarchy-region" "$sandbox/bin/omarchy-region"
for command in omarchy-update-pacman omarchy-pkg-add locale-gen rime-ice-installer omarchy-setup-claude-api systemctl; do
printf '#!/bin/bash\necho "%s $*" >>"%s"\n' "$command" "$calls" >"$test_tmp/bin/$command"
done
printf '#!/bin/bash\necho "omarchy-pkg-add $*" >>"%s"\n[[ -z ${STUB_PKG_FAIL:-} ]]\n' "$calls" >"$test_tmp/bin/omarchy-pkg-add"
printf '#!/bin/bash\n[[ $1 == env ]] && shift\nexec env "$@"\n' >"$test_tmp/bin/sudo"
chmod +x "$test_tmp/bin"/*
export PATH="$test_tmp/bin:$sandbox/bin:$PATH" OMARCHY_PATH="$sandbox" HOME="$test_tmp/home"
@@ -67,6 +68,13 @@ if output=$(omarchy-region mars 2>&1); then
fi
pass "an unknown region is refused"
if output=$(STUB_PKG_FAIL=1 omarchy-region china 2>&1); then
fail "switching to China fails when its packages do not install" "$output"
fi
[[ $(omarchy-region) == "Global" && $(<"$root/etc/pacman.conf") == "$(<"$ROOT/default/pacman/pacman-stable.conf")" && $(<"$root/etc/pacman.d/mirrorlist") == "$(<"$ROOT/default/pacman/mirrorlist-stable")" ]] ||
fail "a failed switch to China leaves the region and the mirrors Global"
pass "a failed switch to China leaves the machine Global"
rc_migration="$test_tmp/1788112314.sh"
rewrite "$ROOT/migrations/1788112314.sh" "$rc_migration"
cp "$ROOT/default/pacman/mirrorlist-rc" "$root/etc/pacman.d/mirrorlist"