From ab517eab85c400bcfc510c04c6d4448da46f0ad0 Mon Sep 17 00:00:00 2001 From: David Fillingham Date: Mon, 16 Mar 2026 11:58:44 +1000 Subject: [PATCH 1/2] Bugfix: booting VM using libvirt flavour never finds IP address Signed-off-by: David Fillingham --- bin/winapps | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/winapps b/bin/winapps index 35ff2ec..faacc09 100755 --- a/bin/winapps +++ b/bin/winapps @@ -572,6 +572,10 @@ function waCheckVMRunning() { TIME_ELAPSED=0 while (( TIME_ELAPSED < BOOT_TIMEOUT )); do + # libvirt users need to find the IP address dynamically + if [[ -z "$RDP_IP" ]]; then + RDP_IP=$(waFindVMIP) + fi # Check if VM is running if (virsh list --state-running --name | grep -Fxq -- "$VM_NAME"); then # Try to connect to RDP port to verify it's ready @@ -720,7 +724,6 @@ function waCheckContainerRunning() { # Role: Assesses whether the RDP port on Windows is open. function waCheckPortOpen() { # Declare variables. - local VM_MAC="" # Stores the MAC address of the Windows VM. local TIME_ELAPSED=0 local TIME_LIMIT=30 local TIME_INTERVAL=5 @@ -728,13 +731,12 @@ function waCheckPortOpen() { # Obtain Windows VM IP Address ('libvirt' ONLY) # Note: 'RDP_IP' should not be empty if 'WAFLAVOR' is 'docker', since it is set to localhost before this function is called. if [ -z "$RDP_IP" ] && [ "$WAFLAVOR" = "libvirt" ]; then - VM_MAC=$(virsh domiflist "$VM_NAME" | grep -oE "([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})") # VM MAC address. while (( TIME_ELAPSED < TIME_LIMIT )); do if [ "$TIME_ELAPSED" -eq "$TIME_INTERVAL" ]; then notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Requesting Windows IP address..." fi - RDP_IP=$(ip neigh show | grep -F -- "$VM_MAC" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") # VM IP address. + RDP_IP=$(waFindVMIP) [ -n "$RDP_IP" ] && break sleep $TIME_INTERVAL TIME_ELAPSED=$((TIME_ELAPSED + TIME_INTERVAL)) @@ -961,6 +963,15 @@ function waTimeSync() { } > "$SLEEP_DETECT_PATH" } +function waFindVMIP() { + local VM_MAC="" + + VM_MAC=$(virsh domiflist "$VM_NAME" | grep -oE "([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})") # VM MAC address. + + # VM IP address + ip neigh show | grep -F -- "$VM_MAC" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" +} + ### MAIN LOGIC ### #set -x # Enable for debugging. mkdir -p "$APPDATA_PATH" From 86e0b9f013d64a51c294dc3be4c62086302e500c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 02:05:47 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- bin/winapps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/winapps b/bin/winapps index faacc09..57a3db7 100755 --- a/bin/winapps +++ b/bin/winapps @@ -967,7 +967,7 @@ function waFindVMIP() { local VM_MAC="" VM_MAC=$(virsh domiflist "$VM_NAME" | grep -oE "([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})") # VM MAC address. - + # VM IP address ip neigh show | grep -F -- "$VM_MAC" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" }