Fixed #697 and #638 using a more robust string comparison

Signed-off-by: Rohan Barar <rohan.barar@gmail.com>
This commit is contained in:
Rohan Barar
2025-09-04 18:55:12 +10:00
parent 63e94e277f
commit d66d41ed9a

View File

@@ -838,16 +838,13 @@ function waCheckVMRunning() {
# Print feedback. # Print feedback.
echo -n "Checking the status of the Windows VM... " echo -n "Checking the status of the Windows VM... "
# Declare variables.
local VM_STATE="" # Stores the state of the Windows VM.
# Obtain VM Status # Obtain VM Status
VM_PAUSED=0 VM_PAUSED=0
virsh list --state-paused | grep -wq "$VM_NAME" || VM_PAUSED="$?" virsh list --state-paused --name | grep -Fxq "$VM_NAME" || VM_PAUSED="$?"
VM_RUNNING=0 VM_RUNNING=0
virsh list --state-running | grep -wq "$VM_NAME" || VM_RUNNING="$?" virsh list --state-running --name | grep -Fxq "$VM_NAME" || VM_RUNNING="$?"
VM_SHUTOFF=0 VM_SHUTOFF=0
virsh list --state-shutoff | grep -wq "$VM_NAME" || VM_SHUTOFF="$?" virsh list --state-shutoff --name | grep -Fxq "$VM_NAME" || VM_SHUTOFF="$?"
if [[ $VM_SHUTOFF == "0" ]]; then if [[ $VM_SHUTOFF == "0" ]]; then
# Complete the previous line. # Complete the previous line.