mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 15:42:20 +00:00
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.
27 lines
746 B
Bash
Executable File
27 lines
746 B
Bash
Executable File
#!/bin/sh
|
|
# Presses keys in the guest, one after another. Join keys with + to press them together.
|
|
# Usage: key.sh <qcode>... for example: key.sh down down ret or: key.sh ctrl+alt+delete
|
|
# Environment: KEY_DELAY is seconds between keys (default 0.3).
|
|
set -e
|
|
|
|
cd "$(dirname "${0}")/../../.." || exit 1
|
|
|
|
. "hack/dev/run/lib.sh"
|
|
require_running
|
|
|
|
[ "${#}" -gt 0 ] || die "usage: key.sh <qcode>..."
|
|
|
|
FIRST=1
|
|
for CHORD in "${@}"; do
|
|
[ "${FIRST}" = "1" ] || sleep "${KEY_DELAY:-0.3}"
|
|
FIRST=0
|
|
KEYS=""
|
|
OLD_IFS="${IFS}"
|
|
IFS="+"
|
|
for KEY in ${CHORD}; do
|
|
KEYS="${KEYS}${KEYS:+,}{\"type\":\"qcode\",\"data\":\"${KEY}\"}"
|
|
done
|
|
IFS="${OLD_IFS}"
|
|
./hack/dev/run/qmp.sh "{\"execute\":\"send-key\",\"arguments\":{\"keys\":[${KEYS}]}}" >/dev/null
|
|
done
|