refactor: display socket hints based on what tools are available

This commit is contained in:
Martin Wimpress 2024-07-04 16:09:41 +01:00 committed by Martin Wimpress
parent 0b1dbb4b9e
commit ca8f81f7fb
1 changed files with 10 additions and 4 deletions

View File

@ -1463,8 +1463,11 @@ function vm_boot() {
elif [ "${monitor}" == "socket" ]; then elif [ "${monitor}" == "socket" ]; then
# shellcheck disable=SC2054,SC2206 # shellcheck disable=SC2054,SC2206
args+=(-monitor unix:${SOCKET_MONITOR},server,nowait) args+=(-monitor unix:${SOCKET_MONITOR},server,nowait)
echo " - Monitor: On host: nc -U \"${SOCKET_MONITOR}\"" if command -v socat &>/dev/null; then
echo " or : socat -,echo=0,icanon=0 unix-connect:${SOCKET_MONITOR}" echo " - Monitor: On host: socat -,echo=0,icanon=0 unix-connect:${SOCKET_MONITOR}"
elif command -v nc &>/dev/null; then
echo " - Monitor: On host: nc -U \"${SOCKET_MONITOR}\""
fi
else else
echo "ERROR! \"${monitor}\" is an unknown monitor option." echo "ERROR! \"${monitor}\" is an unknown monitor option."
exit 1 exit 1
@ -1488,8 +1491,11 @@ function vm_boot() {
elif [ "${serial}" == "socket" ]; then elif [ "${serial}" == "socket" ]; then
# shellcheck disable=SC2054,SC2206 # shellcheck disable=SC2054,SC2206
args+=(-serial unix:${SOCKET_SERIAL},server,nowait) args+=(-serial unix:${SOCKET_SERIAL},server,nowait)
echo " - Serial: On host: nc -U \"${SOCKET_SERIAL}\"" if command -v socat &>/dev/null; then
echo " or : socat -,echo=0,icanon=0 unix-connect:${SOCKET_SERIAL}" echo " - Serial: On host: socat -,echo=0,icanon=0 unix-connect:${SOCKET_SERIAL}"
elif command -v nc &>/dev/null; then
echo " - Serial: On host: nc -U \"${SOCKET_SERIAL}\""
fi
else else
echo "ERROR! \"${serial}\" is an unknown serial option." echo "ERROR! \"${serial}\" is an unknown serial option."
exit 1 exit 1