mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 19:52:22 +00:00
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.
This commit is contained in:
1 parent
4e10d57143
commit
c6524b7bed
12 files changed
+342
-2
No files matched your search
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# Saves a screenshot of the guest display as a PNG and prints its path, ready to be read as an image.
|
||||
# Usage: screenshot.sh [out.png]
|
||||
# Requires QEMU 7.1 or newer for PNG screendumps.
|
||||
set -e
|
||||
|
||||
cd "$(dirname "${0}")/../../.." || exit 1
|
||||
|
||||
. "hack/dev/run/lib.sh"
|
||||
require_running
|
||||
|
||||
OUT="${1:-${SHOT_DIR}/$(date +%H%M%S).png}"
|
||||
case "${OUT}" in
|
||||
/*) ;;
|
||||
*) OUT="$(pwd)/${OUT}" ;;
|
||||
esac
|
||||
mkdir -p "$(dirname "${OUT}")"
|
||||
|
||||
./hack/dev/run/qmp.sh "{\"execute\":\"screendump\",\"arguments\":{\"filename\":\"${OUT}\",\"format\":\"png\"}}" >/dev/null
|
||||
[ -s "${OUT}" ] || die "QEMU did not write ${OUT}"
|
||||
echo "${OUT}"
|
||||
Reference in new issue
Block a user