From 4003144cf61265035cc6ebccf483eff5f42bc042 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Mon, 25 Oct 2021 13:40:35 +0100 Subject: [PATCH] Add ports file. Close #156 --- quickemu | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/quickemu b/quickemu index c979624..cece5a5 100755 --- a/quickemu +++ b/quickemu @@ -692,10 +692,13 @@ function vm_boot() { # Set the hostname of the VM local NET="user,hostname=${VMNAME}" + echo -n "" > "${VMDIR}/${VMNAME}.ports" + # Find a free port to expose ssh to the guest local SSH_PORT="" SSH_PORT=$(get_port 22220 9) if [ -n "${SSH_PORT}" ]; then + echo "ssh,${SSH_PORT}" >> "${VMDIR}/${VMNAME}.ports" NET="${NET},hostfwd=tcp::${SSH_PORT}-:22" echo " - ssh: On host: ssh user@localhost -p ${SSH_PORT}" else @@ -727,6 +730,7 @@ function vm_boot() { if [ "${OUTPUT}" == "spice-app" ]; then echo " - SPICE: Enabled" else + echo "spice,${SPICE_PORT}" >> "${VMDIR}/${VMNAME}.ports" echo -n " - SPICE: On host: spicy --title \"${VMNAME}\" --port ${SPICE_PORT}" if [ "${guest_os}" != "macos" ] && [ -n "${PUBLIC}" ]; then echo -n " --spice-shared-dir ${PUBLIC}"