Default the region to Global so deferring before choosing still installs

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 23:25:57 -04:00
1 parent c1d5725837
commit 22d02f0069
2 files changed
+37

No files matched your search

+1
View File
@@ -1039,6 +1039,7 @@ select_installation() {
defer_provisioning=false
install_target="full_disk"
region="global"
# Let the live VT reach its settled width before the first screen so the logo
# isn't measured against the transient 80-column boot console.
+36
View File
@@ -2,6 +2,8 @@
import json
import os
import re
import subprocess
import sys
import tempfile
import types
@@ -72,6 +74,40 @@ class RegionTest(unittest.TestCase):
chroot = next(call.args[0] for call in run.call_args_list if call.args[0][0] == "arch-chroot")
self.assertIn(f"OMARCHY_REGION={region}", chroot)
def run_keyboard_form(self, script: str) -> str:
configurator = (ROOT / "configs/airootfs/root/configurator").read_text()
form = re.search(r"^keyboard_form\(\) \{\n.*?^\}", configurator, re.M | re.S)
init = re.search(r'^region="global"$', configurator, re.M)
self.assertIsNotNone(form)
self.assertIsNotNone(init)
harness = "\n".join([
"set -euo pipefail",
"OMARCHY_FORM_BACK=1; OMARCHY_FORM_SIGNAL=130; defer_provisioning=false",
"clear_logo() { :; }; say() { :; }; abort() { exit 99; }; tty() { echo /dev/pts/0; }",
"answers=(" + script + "); step=0",
"answer() { local a=${answers[step]}; step=$((step + 1)); [[ $a == ok:* ]] && eval \"${a#ok:}\" && return 0; return ${a#rc:}; }",
"omarchy_prompt_region() { echo \"region-preselect=$region\"; answer; }",
"omarchy_prompt_keyboard() { answer; }",
"confirm_prepare_for_another_owner() { answer; }",
init.group(),
form.group(),
"keyboard_form",
'echo "region=$region defer=$defer_provisioning"',
])
return subprocess.run(["bash", "-c", harness], check=True, capture_output=True, text=True).stdout
def test_ctrl_c_before_choosing_defers_as_global(self):
out = self.run_keyboard_form("rc:130 ok:true")
self.assertIn("region=global defer=true", out)
def test_back_from_keyboard_keeps_the_chosen_region(self):
out = self.run_keyboard_form("ok:region=china rc:1 ok:true ok:keyboard=us")
self.assertEqual([line for line in out.splitlines() if line], [
"region-preselect=global",
"region-preselect=china",
"region=china defer=false",
])
if __name__ == "__main__":
unittest.main()