fix: Device detection

* fix: Device detection
This commit is contained in:
Kroese 2023-12-28 08:31:32 +01:00 committed by GitHub
parent 69e785e6ee
commit 9db12cd25f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,19 +24,26 @@ if [[ "$CONSOLE" == [Yy]* ]]; then
fi
[[ "$DEBUG" == [Yy1]* ]] && info "$VERS" && set -x
dev=$(qemu-system-x86_64 -daemonize -pidfile "$QEMU_PID" ${ARGS:+ $ARGS})
msg=$(qemu-system-x86_64 -daemonize -pidfile "$QEMU_PID" ${ARGS:+ $ARGS})
{ set +x; } 2>/dev/null
if [[ "$dev" != "char"* || "$dev" != *"redirected to"* || "$dev" != *")" ]]; then
error "$dev"
finish 33
if [[ "$msg" != "char"* || "$msg" != *"serial0)" ]]; then
echo "$msg"
fi
dev="${dev#*/dev/}"
dev="/dev/${dev%% *}"
dev="${msg#*/dev/p}"
dev="/dev/p${dev%% *}"
if [ ! -c "$dev" ]; then
error "Device $dev not found!"
dev=$(echo 'info chardev' | nc -q 1 -w 1 localhost "$QEMU_PORT" | tr -d '\000')
dev="${dev#*charserial0}"
dev="${dev#*pty:}"
dev="${dev%%$'\n'*}"
dev="${dev%%$'\r'*}"
fi
if [ ! -c "$dev" ]; then
error "Device `$dev` not found!"
finish 34
fi