diff --git a/src/entry.sh b/src/entry.sh index dc7ec16..48c2da0 100755 --- a/src/entry.sh +++ b/src/entry.sh @@ -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