Files
alex c6524b7bed feat(hack): add scripts to drive the dev environment headless
Start QEMU in the background with a QMP socket and console logs, take
screenshots, press keys and wait for serial output, so the graphical boot
menu can be driven without a terminal or a window. boot.sh gets opt-in
knobs for this and behaves as before otherwise.
2026-10-04 10:24:36 -07:00

35 lines
928 B
Bash

#!/bin/sh
# Shared by the other scripts in this directory: source it after changing to the repository root.
# shellcheck disable=SC2034
# common.sh reads the architecture from the first argument, which belongs to the calling script here.
load_common() {
set --
. "hack/common.sh"
}
load_common
RUN_DIR="$(pwd)/target/run/${TARGET_ARCH}"
SHOT_DIR="${RUN_DIR}/shots"
SERIAL_LOG="${RUN_DIR}/serial.log"
CONSOLE_LOG="${RUN_DIR}/console.log"
QEMU_LOG="${RUN_DIR}/qemu.log"
PID_FILE="${RUN_DIR}/qemu.pid"
# Unix socket paths are limited to about 104 bytes on macOS, which a deep worktree exceeds.
QMP_SOCK="${TMPDIR:-/tmp}"
QMP_SOCK="${QMP_SOCK%/}/sprout-${TARGET_ARCH}.qmp"
die() {
echo "ERROR: ${*}" >/dev/stderr
exit 1
}
is_running() {
[ -f "${PID_FILE}" ] && kill -0 "$(cat "${PID_FILE}")" 2>/dev/null
}
require_running() {
is_running || die "no ${TARGET_ARCH} QEMU is running, start one with hack/dev/run/start.sh"
}