#!/usr/bin/env bash source "/etc/conf.d/qemu.d/$1" args+=( -name "$1",debug-threads=on -pidfile "/run/qemu-$1/pid" -vnc unix:"/run/qemu-$1/vnc.sock" -monitor unix:"/run/qemu-$1/monitor.sock",server,nowait -serial unix:"/run/qemu-$1/ttyS0.sock",server -daemonize ) { until [[ -S /run/qemu-$1/ttyS0.sock ]]; do :; done exec socat UNIX-CONNECT:"/run/qemu-$1/ttyS0.sock" STDOUT > >(exec cat) } & qemu-system-"${system}" "${args[@]}" systemd-notify --ready