Record the installer's region choice during system setup

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 23:20:36 -04:00
1 parent 83d158ad07
commit c86af5cea5
6 files changed
+68 -4

No files matched your search

+20
View File
@@ -54,3 +54,23 @@ if output=$("$region_bin" 2>&1); then
fi
[[ $output == "Unknown region in $region_file: mars" ]] || fail "an unknown region names the file and value" "$output"
pass "an unknown region fails and names the file and value"
region_setup="$test_tmp/region.sh"
sed "s|/etc/omarchy|$test_tmp/etc-omarchy|g" "$ROOT/install/config/region.sh" >"$region_setup"
OMARCHY_REGION=china bash -e "$region_setup"
[[ $(<"$test_tmp/etc-omarchy/region") == "china" ]] || fail "install records the China region"
pass "install records the China region"
OMARCHY_REGION=global bash -e "$region_setup"
[[ ! -e $test_tmp/etc-omarchy/region ]] || fail "install records Global by leaving no region file"
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"
pass "Global and an unset region leave no region file"
if output=$(OMARCHY_REGION=mars bash -e "$region_setup" 2>&1); then
fail "install rejects an unknown region" "$output"
fi
[[ $output == "Unknown OMARCHY_REGION: mars" ]] || fail "install names the unknown region" "$output"
pass "install rejects an unknown region"