From ca347878ba006059020e960188fd636cca8952c7 Mon Sep 17 00:00:00 2001 From: Jack <31696646+myspaghetti@users.noreply.github.com> Date: Tue, 4 Feb 2020 17:57:36 +0200 Subject: [PATCH] better check that the VM is powered off --- macos-guest-virtualbox.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/macos-guest-virtualbox.sh b/macos-guest-virtualbox.sh index 6600211..a467c62 100755 --- a/macos-guest-virtualbox.sh +++ b/macos-guest-virtualbox.sh @@ -2,7 +2,7 @@ # Semi-automatic installer of macOS on VirtualBox # (c) myspaghetti, licensed under GPL2.0 or higher # url: https://github.com/myspaghetti/macos-guest-virtualbox -# version 0.86.4 +# version 0.86.5 # Requirements: 40GB available storage on host # Dependencies: bash >= 4.3, xxd, gzip, unzip, wget, dmg2img, @@ -853,7 +853,7 @@ printf '\n'"${highlight_color}"'That'"'"'s it! Enjoy your virtual machine.'"${de function delete_temporary_files() { print_dimly "stage: delete_temporary_files" -if [[ "$( VBoxManage list runningvms )" =~ \""${vmname}"\" ]]; +if [[ ! "$(VBoxManage showvminfo "${vmname}")" =~ State:[\ \t]*powered\ off ]]; then printf 'Temporary files may be deleted when the virtual machine is powered off and without a suspended state by running the following command at the script'"'"'s @@ -861,8 +861,6 @@ working directory: '"${highlight_color}${0} delete_temporary_files${default_color}"'\n' else - # discard saved state - VBoxManage discardstate "${vmname}" 2>&1 # detach temporary VDIs and attach the macOS target disk VBoxManage storagectl "${vmname}" --remove --name SATA >/dev/null 2>&1 VBoxManage storagectl "${vmname}" --add sata --name SATA --hostiocache on >/dev/null 2>&1