Drive China installs through the Chinese screens in the ISO test harness
This commit is contained in:
1 parent
48471b25c1
commit
555093811f
1 file changed
+34
-21
+34
-21
@@ -92,7 +92,19 @@ if [[ $REGION != "global" && $REGION != "china" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
omarchy-pkg-add qemu-full edk2-ovmf socat imagemagick tesseract tesseract-data-eng
|
omarchy-pkg-add qemu-full edk2-ovmf socat imagemagick tesseract tesseract-data-eng tesseract-data-chi_sim
|
||||||
|
|
||||||
|
# After the region screen a China install reads in Chinese.
|
||||||
|
OCR_LANGS=eng
|
||||||
|
[[ $REGION == "china" ]] && OCR_LANGS=eng+chi_sim
|
||||||
|
# region_text <english> <chinese> picks the text a screen shows in this run.
|
||||||
|
region_text() {
|
||||||
|
if [[ $REGION == "china" ]]; then
|
||||||
|
printf '%s' "$2"
|
||||||
|
else
|
||||||
|
printf '%s' "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
OVMF_CODE="/usr/share/edk2/x64/OVMF_CODE.4m.fd"
|
OVMF_CODE="/usr/share/edk2/x64/OVMF_CODE.4m.fd"
|
||||||
OVMF_VARS_TEMPLATE="/usr/share/edk2/x64/OVMF_VARS.4m.fd"
|
OVMF_VARS_TEMPLATE="/usr/share/edk2/x64/OVMF_VARS.4m.fd"
|
||||||
@@ -249,7 +261,7 @@ ocr_screen() {
|
|||||||
screendump "$shot"
|
screendump "$shot"
|
||||||
[[ -s $shot ]] || return 0
|
[[ -s $shot ]] || return 0
|
||||||
magick "$shot" -colorspace gray -negate -resize 150% "$prepped" 2>/dev/null || return 0
|
magick "$shot" -colorspace gray -negate -resize 150% "$prepped" 2>/dev/null || return 0
|
||||||
tesseract "$prepped" - --psm 6 2>/dev/null || true
|
tesseract "$prepped" - --psm 6 -l "$OCR_LANGS" 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# Wait until the console shows the given text. Saves the offending screen as
|
# Wait until the console shows the given text. Saves the offending screen as
|
||||||
@@ -633,22 +645,23 @@ drive_configurator() {
|
|||||||
[[ $REGION == "china" ]] && press down
|
[[ $REGION == "china" ]] && press down
|
||||||
press ret
|
press ret
|
||||||
|
|
||||||
# Keyboard follows; Ctrl+C there defers provisioning.
|
# Keyboard follows; Ctrl+C there defers provisioning. China reruns the
|
||||||
wait_for_screen "keyboard layout" 300
|
# installer in cage + foot, so the next screens are Chinese.
|
||||||
|
wait_for_screen "$(region_text "keyboard layout" "键盘")" 300
|
||||||
capture_console "success-installer-01-keyboard-layout"
|
capture_console "success-installer-01-keyboard-layout"
|
||||||
|
|
||||||
if $PROVISION; then
|
if $PROVISION; then
|
||||||
press ctrl-c # arm "prepare for another owner"
|
press ctrl-c # arm "prepare for another owner"
|
||||||
wait_for_screen "another owner" 30
|
wait_for_screen "$(region_text "another owner" "另一位")" 30
|
||||||
capture_console "success-installer-02-prepare-confirm"
|
capture_console "success-installer-02-prepare-confirm"
|
||||||
press ret # "Yes, prepare for another owner" is the affirmative default
|
press ret # "Yes, prepare for another owner" is the affirmative default
|
||||||
|
|
||||||
# Jumps straight to disk selection, then the overwrite confirm.
|
# Jumps straight to disk selection, then the overwrite confirm.
|
||||||
wait_for_screen "install disk" 60
|
wait_for_screen "$(region_text "install disk" "安装磁盘")" 60
|
||||||
capture_console "success-installer-03-prepare-install-disk"
|
capture_console "success-installer-03-prepare-install-disk"
|
||||||
press ret
|
press ret
|
||||||
|
|
||||||
wait_for_screen "recovery possible" 60
|
wait_for_screen "$(region_text "recovery possible" "无法恢复")" 60
|
||||||
capture_console "success-installer-04-prepare-disk-warning-encrypted"
|
capture_console "success-installer-04-prepare-disk-warning-encrypted"
|
||||||
if ! $ENCRYPT; then
|
if ! $ENCRYPT; then
|
||||||
press ctrl-c
|
press ctrl-c
|
||||||
@@ -668,55 +681,55 @@ drive_configurator() {
|
|||||||
press ret # English (US) is preselected
|
press ret # English (US) is preselected
|
||||||
|
|
||||||
# Normal flow: user step comes before disk selection.
|
# Normal flow: user step comes before disk selection.
|
||||||
wait_for_screen "Username" 120
|
wait_for_screen "$(region_text "Username" "用户名")" 120
|
||||||
type_text "$GUEST_USER"
|
type_text "$GUEST_USER"
|
||||||
capture_console "success-installer-02-username"
|
capture_console "success-installer-02-username"
|
||||||
press ret
|
press ret
|
||||||
|
|
||||||
wait_for_screen "Password" 60
|
wait_for_screen "$(region_text "Password" "密码")" 60
|
||||||
type_text "$GUEST_PASSWORD"
|
type_text "$GUEST_PASSWORD"
|
||||||
capture_console "success-installer-03-password"
|
capture_console "success-installer-03-password"
|
||||||
press ret
|
press ret
|
||||||
|
|
||||||
wait_for_screen "Must match" 60
|
wait_for_screen "$(region_text "Must match" "确认")" 60
|
||||||
type_text "$GUEST_PASSWORD"
|
type_text "$GUEST_PASSWORD"
|
||||||
capture_console "success-installer-04-password-confirmation"
|
capture_console "success-installer-04-password-confirmation"
|
||||||
press ret
|
press ret
|
||||||
|
|
||||||
wait_for_screen "Full name" 60
|
wait_for_screen "$(region_text "Full name" "姓名")" 60
|
||||||
type_text "Omarchy Test"
|
type_text "Omarchy Test"
|
||||||
capture_console "success-installer-05-full-name"
|
capture_console "success-installer-05-full-name"
|
||||||
press ret
|
press ret
|
||||||
|
|
||||||
wait_for_screen "Email address" 60
|
wait_for_screen "$(region_text "Email address" "邮箱")" 60
|
||||||
type_text "test@omarchy.org"
|
type_text "test@omarchy.org"
|
||||||
capture_console "success-installer-06-email"
|
capture_console "success-installer-06-email"
|
||||||
press ret
|
press ret
|
||||||
|
|
||||||
wait_for_screen "Hostname" 60
|
wait_for_screen "$(region_text "Hostname" "主机名")" 60
|
||||||
type_text "$GUEST_HOSTNAME"
|
type_text "$GUEST_HOSTNAME"
|
||||||
capture_console "success-installer-07-hostname"
|
capture_console "success-installer-07-hostname"
|
||||||
press ret
|
press ret
|
||||||
|
|
||||||
wait_for_screen "Timezone" 180 # tzupdate geo-guess can take a moment
|
wait_for_screen "$(region_text "Timezone" "时区")" 180 # tzupdate geo-guess can take a moment
|
||||||
capture_console "success-installer-08-timezone"
|
capture_console "success-installer-08-timezone"
|
||||||
press ret
|
press ret
|
||||||
|
|
||||||
wait_for_screen "look right" 60
|
wait_for_screen "$(region_text "look right" "正确")" 60
|
||||||
capture_console "success-installer-09-review"
|
capture_console "success-installer-09-review"
|
||||||
press ret
|
press ret
|
||||||
|
|
||||||
wait_for_screen "install disk" 60
|
wait_for_screen "$(region_text "install disk" "安装磁盘")" 60
|
||||||
capture_console "success-installer-10-install-disk"
|
capture_console "success-installer-10-install-disk"
|
||||||
press ret # the single virtio disk
|
press ret # the single virtio disk
|
||||||
|
|
||||||
wait_for_screen "installation mode\|recovery possible" 60
|
wait_for_screen "$(region_text "installation mode\|recovery possible" "安装方式\|无法恢复")" 60
|
||||||
if ocr_screen | grep -qi "installation mode"; then
|
if ocr_screen | grep -qi "$(region_text "installation mode" "安装方式")"; then
|
||||||
capture_console "success-installer-11-install-mode"
|
capture_console "success-installer-11-install-mode"
|
||||||
press ret # "Full disk install" is preselected
|
press ret # "Full disk install" is preselected
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wait_for_screen "recovery possible" 60
|
wait_for_screen "$(region_text "recovery possible" "无法恢复")" 60
|
||||||
capture_console "success-installer-12-disk-warning-encrypted"
|
capture_console "success-installer-12-disk-warning-encrypted"
|
||||||
if ! $ENCRYPT; then
|
if ! $ENCRYPT; then
|
||||||
press ctrl-c # toggles the confirm to the unencrypted flow
|
press ctrl-c # toggles the confirm to the unencrypted flow
|
||||||
@@ -810,7 +823,7 @@ wait_for_install() {
|
|||||||
while true; do
|
while true; do
|
||||||
text=$(ocr_screen)
|
text=$(ocr_screen)
|
||||||
|
|
||||||
if grep -qi "Reboot Now" <<<"$text"; then
|
if grep -qi "$(region_text "Reboot Now" "立即重启")" <<<"$text"; then
|
||||||
log "Install finished. Confirming the reboot prompt."
|
log "Install finished. Confirming the reboot prompt."
|
||||||
capture_console "success-installer-15-reboot"
|
capture_console "success-installer-15-reboot"
|
||||||
press ret
|
press ret
|
||||||
@@ -826,7 +839,7 @@ wait_for_install() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -qi "installation stopped" <<<"$text"; then
|
if grep -qi "$(region_text "installation stopped" "安装已停止")" <<<"$text"; then
|
||||||
capture_console "failure-installer-installation-stopped"
|
capture_console "failure-installer-installation-stopped"
|
||||||
echo "Install failed — screenshot saved to $RUN_DIR" >&2
|
echo "Install failed — screenshot saved to $RUN_DIR" >&2
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
Reference in new issue
Block a user