From 17c6fd32935a3a8154062a6b19f6bc4074bd4b6d Mon Sep 17 00:00:00 2001 From: Coruscant11 Date: Sun, 18 Aug 2024 14:12:48 +0200 Subject: [PATCH] Installer VM detection not impacted by system language --- installer.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/installer.sh b/installer.sh index 554a373..d460c76 100755 --- a/installer.sh +++ b/installer.sh @@ -746,9 +746,14 @@ function waCheckVMRunning() { local VM_STATE="" # Stores the state of the Windows VM. # Obtain VM Status - VM_STATE=$(virsh list --all | grep -w "$VM_NAME") + VM_PAUSED=0 + virsh list --state-paused | grep -wq "$VM_NAME" || VM_PAUSED="$?" + VM_RUNNING=0 + virsh list --state-running | grep -wq "$VM_NAME" || VM_RUNNING="$?" + VM_SHUTOFF=0 + virsh list --state-shutoff | grep -wq "$VM_NAME" || VM_SHUTOFF="$?" - if [[ $VM_STATE == *"shut off"* ]]; then + if [[ $VM_SHUTOFF == "0" ]]; then # Complete the previous line. echo -e "${FAIL_TEXT}Failed!${CLEAR_TEXT}\n" @@ -766,7 +771,7 @@ function waCheckVMRunning() { # Terminate the script. return "$EC_VM_OFF" - elif [[ $VM_STATE == *"paused"* ]]; then + elif [[ $VM_PAUSED == "0" ]]; then # Complete the previous line. echo -e "${FAIL_TEXT}Failed!${CLEAR_TEXT}\n" @@ -784,7 +789,7 @@ function waCheckVMRunning() { # Terminate the script. return "$EC_VM_PAUSED" - elif [[ $VM_STATE != *"running"* ]]; then + elif [[ $VM_RUNNING != "0" ]]; then # Complete the previous line. echo -e "${FAIL_TEXT}Failed!${CLEAR_TEXT}\n"