discard suspended state before deleting temporary files

This commit is contained in:
Jack
2020-02-04 17:47:16 +02:00
parent ac3a9fa686
commit f0edf53fbc
+6 -3
View File
@@ -2,7 +2,7 @@
# Semi-automatic installer of macOS on VirtualBox # Semi-automatic installer of macOS on VirtualBox
# (c) myspaghetti, licensed under GPL2.0 or higher # (c) myspaghetti, licensed under GPL2.0 or higher
# url: https://github.com/myspaghetti/macos-guest-virtualbox # url: https://github.com/myspaghetti/macos-guest-virtualbox
# version 0.86.3 # version 0.86.4
# Requirements: 40GB available storage on host # Requirements: 40GB available storage on host
# Dependencies: bash >= 4.3, xxd, gzip, unzip, wget, dmg2img, # Dependencies: bash >= 4.3, xxd, gzip, unzip, wget, dmg2img,
@@ -855,11 +855,14 @@ function delete_temporary_files() {
print_dimly "stage: delete_temporary_files" print_dimly "stage: delete_temporary_files"
if [[ "$( VBoxManage list runningvms )" =~ \""${vmname}"\" ]]; if [[ "$( VBoxManage list runningvms )" =~ \""${vmname}"\" ]];
then then
printf 'Temporary files may be deleted when the virtual machine is shut down printf 'Temporary files may be deleted when the virtual machine is powered off
by running the following command at the script'"'"'s working directory: and without a suspended state by running the following command at the script'"'"'s
working directory:
'"${highlight_color}${0} delete_temporary_files${default_color}"'\n' '"${highlight_color}${0} delete_temporary_files${default_color}"'\n'
else else
# discard saved state
VBoxManage discardstate "${vmname}" 2>&1
# detach temporary VDIs and attach the macOS target disk # detach temporary VDIs and attach the macOS target disk
VBoxManage storagectl "${vmname}" --remove --name SATA >/dev/null 2>&1 VBoxManage storagectl "${vmname}" --remove --name SATA >/dev/null 2>&1
VBoxManage storagectl "${vmname}" --add sata --name SATA --hostiocache on >/dev/null 2>&1 VBoxManage storagectl "${vmname}" --add sata --name SATA --hostiocache on >/dev/null 2>&1