Unverified Commit 3a507f5b authored by Kroese's avatar Kroese Committed by GitHub
Browse files

fix: Display QEMU output (#558)

parent a3d6e374
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -22,11 +22,12 @@ if [[ "$CONSOLE" == [Yy]* ]]; then
  exec qemu-system-x86_64 ${ARGS:+ $ARGS}
fi

[[ "$DEBUG" == [Yy1]* ]] && info "$VERS" && set -x
msg=$(qemu-system-x86_64 ${ARGS:+ $ARGS})
[[ "$DEBUG" == [Yy1]* ]] && info "$VERS" && echo "Arguments: $ARGS" && echo
{ qemu-system-x86_64 ${ARGS:+ $ARGS} >"$QEMU_OUT" 2>"$QEMU_LOG"; rc=$?; } || :
(( rc != 0 )) && error "$(cat "$QEMU_LOG")" && exit 15

{ set +x; } 2>/dev/null && terminal "$msg"
terminal
tail -fn +0 "$QEMU_LOG" 2>/dev/null &
cat "$QEMU_TERM" 2>/dev/null & wait $! || true
cat "$QEMU_TERM" 2>/dev/null & wait $! || :

sleep 1 && finish 0
+17 −9
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ QEMU_PORT=7100
QEMU_TIMEOUT=50
QEMU_PID="/run/qemu.pid"
QEMU_LOG="/run/qemu.log"
QEMU_OUT="/run/qemu.out"
QEMU_END="/run/qemu.end"

if [[ "$KVM" == [Nn]* ]]; then
@@ -19,9 +20,6 @@ if [[ "$KVM" == [Nn]* ]]; then
  QEMU_TIMEOUT=$(( QEMU_TIMEOUT*2 ))
fi

rm -f "$QEMU_PID"
rm -f "$QEMU_LOG"
rm -f "$QEMU_END"
touch "$QEMU_LOG"

_trap() {
@@ -62,15 +60,25 @@ finish() {

terminal() {

  local msg=$1
  local dev=""

  if [ -f "$QEMU_OUT" ]; then

    local msg
    msg="$(cat "$QEMU_OUT")"

    if [ -n "$msg" ]; then

      if [[ "${msg,,}" != "char"* ||  "$msg" != *"serial0)" ]]; then
        echo "$msg"
      fi

  local dev="${msg#*/dev/p}"
      dev="${msg#*/dev/p}"
      dev="/dev/p${dev%% *}"

    fi
  fi

  if [ ! -c "$dev" ]; then
    dev=$(echo 'info chardev' | nc -q 1 -w 1 localhost "$QEMU_PORT" | tr -d '\000')
    dev="${dev#*serial0}"
+1 −4
Original line number Diff line number Diff line
@@ -36,10 +36,7 @@ STORAGE="/storage"
# Cleanup files

rm -f /run/dsm.url
rm -f /run/qemu.ip
rm -f /run/qemu.log
rm -f /run/qemu.pid
rm -f /run/qemu.end
rm -f /run/qemu.*

# Cleanup dirs

+2 −2

File changed.

Contains only whitespace changes.