Merge omacom/omarchy-iso#236 regional ISO builds, as an install-time choice

Every ISO bundles the cn profile; the first-screen pick decides. --region cn
only preselects China and names the artifact. The region value is cn, the cn
timezone is preselected when China is chosen, and the profile packages and
ArchLinuxCN keyring reach the target only for China.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-07 11:32:14 -04:00
commit 02ee068504
12 files changed
+492 -50

No files matched your search

+8 -8
View File
@@ -14,7 +14,7 @@
# Usage: omarchy-iso-test [release/omarchy.iso] [options]
#
# --encrypt Drive the encrypted install flow (default: unencrypted)
# --region REGION Pick global (default) or china on the first screen
# --region REGION Pick global (default) or cn on the first screen
# --provision Drive the deferred-provisioning install flow: no user during install, the
# first boot runs omarchy-provision-owner and creates it there
# --reuse-base Skip the install phase if a base image already exists
@@ -87,8 +87,8 @@ if [[ ! -f ${ISO:-} ]]; then
exit 1
fi
if [[ $REGION != "global" && $REGION != "china" ]]; then
echo "--region must be global or china, not $REGION" >&2
if [[ $REGION != "global" && $REGION != "cn" ]]; then
echo "--region must be global or cn, not $REGION" >&2
exit 1
fi
@@ -96,10 +96,10 @@ omarchy-pkg-add qemu-full edk2-ovmf socat imagemagick tesseract tesseract-data-e
# After the region screen a China install reads in Chinese.
OCR_LANGS=eng
[[ $REGION == "china" ]] && OCR_LANGS=eng+chi_sim
[[ $REGION == "cn" ]] && OCR_LANGS=eng+chi_sim
# region_text <english> <chinese> picks the text a screen shows in this run.
region_text() {
if [[ $REGION == "china" ]]; then
if [[ $REGION == "cn" ]]; then
printf '%s' "$2"
else
printf '%s' "$1"
@@ -111,7 +111,7 @@ OVMF_VARS_TEMPLATE="/usr/share/edk2/x64/OVMF_VARS.4m.fd"
BASE_NAME="$(basename "$ISO" .iso)"
$ENCRYPT && BASE_NAME+="-encrypted"
[[ $REGION == "china" ]] && BASE_NAME+="-china"
[[ $REGION == "cn" ]] && BASE_NAME+="-cn"
$PROVISION && BASE_NAME+="-provision"
BASE_DIR="$REPO_DIR/test-runs/$BASE_NAME"
RUN_DIR="$BASE_DIR/runs/$(date +%Y%m%d-%H%M%S)"
@@ -262,7 +262,7 @@ ocr_screen() {
[[ -s $shot ]] || return 0
magick "$shot" -colorspace gray -negate -resize 150% "$prepped" 2>/dev/null || return 0
# The logo and the black strip under foot throw tesseract off CJK, so China runs also read between them, without spaces.
if [[ $REGION == "china" ]]; then
if [[ $REGION == "cn" ]]; then
magick "$shot" -gravity north -chop 0x35% -gravity south -chop 0x4% -colorspace gray -negate -resize 150% "$prepped.text.png" 2>/dev/null || return 0
{ tesseract "$prepped" - --psm 6 -l "$OCR_LANGS"; tesseract "$prepped.text.png" - --psm 6 -l "$OCR_LANGS"; } 2>/dev/null | sed 'p; s/ //g' || true
else
@@ -648,7 +648,7 @@ drive_configurator() {
# Region comes first, Global preselected and China one row below.
wait_for_screen "Select region" 300
capture_console "success-installer-01-region"
[[ $REGION == "china" ]] && press down
[[ $REGION == "cn" ]] && press down
press ret
# Global asks for the keyboard; China reruns in cage + foot on a bilingual region screen with a US keyboard. Ctrl+C on either defers provisioning.