VirtualBox 6.1 doesn't need 3rd party APFS drivers
This commit is contained in:
@@ -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.76.8
|
# version 0.77.0
|
||||||
|
|
||||||
# Requirements: 40GB available storage on host
|
# Requirements: 40GB available storage on host
|
||||||
# Dependencies: bash >= 4.0, unzip, wget, dmg2img,
|
# Dependencies: bash >= 4.0, unzip, wget, dmg2img,
|
||||||
@@ -871,11 +871,15 @@ kbstring='app_path="$(ls -d /Install*.app)" && cd "/${app_path}/Contents/Resourc
|
|||||||
send_keys
|
send_keys
|
||||||
echo ""
|
echo ""
|
||||||
echo "Installer started."
|
echo "Installer started."
|
||||||
|
if [[ ! "$(VBoxManage -v 2>/dev/null)" =~ ^6\.1 ]]; then
|
||||||
echo "When the installer finishes preparing, the virtual machine will reboot"
|
echo "When the installer finishes preparing, the virtual machine will reboot"
|
||||||
echo "into the base system again, not the installer."
|
echo "into the base system again, not the installer."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function place_efi_apfs_drivers {
|
function place_efi_apfs_drivers {
|
||||||
|
# VirtualBox 6.1 has own EFI APFS drivers, doesn't require acidanthera drivers
|
||||||
|
if [[ ! "$(VBoxManage -v 2>/dev/null)" =~ ^6\.1 ]]; then
|
||||||
printf "${white_on_black}"'
|
printf "${white_on_black}"'
|
||||||
After the VM boots, press enter when either the Language window'"${default_color}"'
|
After the VM boots, press enter when either the Language window'"${default_color}"'
|
||||||
'"${white_on_black}"'or Utilities window is ready.'"${default_color}"
|
'"${white_on_black}"'or Utilities window is ready.'"${default_color}"
|
||||||
@@ -907,10 +911,13 @@ echo ""
|
|||||||
echo "Placing EFI startup script that searches for boot.efi on the EFI partition"
|
echo "Placing EFI startup script that searches for boot.efi on the EFI partition"
|
||||||
kbstring='cp "/Volumes/'"${macOS_release_name:0:5}-files"'/startup.nsh" "/Volumes/'"${vmname}"'/mount_efi/startup.nsh"'
|
kbstring='cp "/Volumes/'"${macOS_release_name:0:5}-files"'/startup.nsh" "/Volumes/'"${vmname}"'/mount_efi/startup.nsh"'
|
||||||
send_keys
|
send_keys
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function detach_installer_vdi_and_viso() {
|
function detach_installer_vdi_and_viso() {
|
||||||
|
#VirtualBox 6.1 completes the installation before the script
|
||||||
|
#gets a chance to detach the installer and VISO
|
||||||
|
if [[ ! "$(VBoxManage -v 2>/dev/null)" =~ ^6\.1 ]]; then
|
||||||
# Shut down the virtual machine
|
# Shut down the virtual machine
|
||||||
printf "${white_on_black}"'
|
printf "${white_on_black}"'
|
||||||
Press enter when the terminal is ready.'"${default_color}"
|
Press enter when the terminal is ready.'"${default_color}"
|
||||||
@@ -927,16 +934,30 @@ read -p ""
|
|||||||
# detach installer from virtual machine
|
# detach installer from virtual machine
|
||||||
VBoxManage storageattach "${vmname}" --storagectl SATA --port 1 --medium none
|
VBoxManage storageattach "${vmname}" --storagectl SATA --port 1 --medium none
|
||||||
VBoxManage storageattach "${vmname}" --storagectl SATA --port 3 --medium none
|
VBoxManage storageattach "${vmname}" --storagectl SATA --port 3 --medium none
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function boot_macos_and_clean_up() {
|
function boot_macos_and_clean_up() {
|
||||||
echo "The VM will boot from the target virtual disk image."
|
echo "The VM will boot from the target virtual disk image."
|
||||||
|
if [[ ! "$(VBoxManage -v 2>/dev/null)" =~ ^6\.1 ]]; then
|
||||||
|
#VM was not previously shut down on 6.1, no need to start
|
||||||
VBoxManage startvm "${vmname}"
|
VBoxManage startvm "${vmname}"
|
||||||
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
echo "macOS will now install and start up."
|
echo "macOS will now install and start up. This will take several minutes."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# temporary files cleanup
|
# temporary files cleanup
|
||||||
|
if [[ "$(VBoxManage -v 2>/dev/null)" =~ ^6\.1 ]]; then
|
||||||
|
# detach installer from virtual machine for VirtualBox 6.1
|
||||||
|
# because the script didn't have a chance to shut down the VM
|
||||||
|
echo 'Please allow the installer to finish, then complete the initial boot setup.'
|
||||||
|
echo 'After macOS is set up, shut down the virtual machine to delete temporary files.'
|
||||||
|
printf "${white_on_black}"'Press enter when shutdown is complete.'"${default_color}"
|
||||||
|
read -p ""
|
||||||
|
VBoxManage storageattach "${vmname}" --storagectl SATA --port 1 --medium none
|
||||||
|
VBoxManage storageattach "${vmname}" --storagectl SATA --port 3 --medium none
|
||||||
|
fi
|
||||||
VBoxManage closemedium "${macOS_release_name}_BaseSystem.vdi" 2>/dev/null
|
VBoxManage closemedium "${macOS_release_name}_BaseSystem.vdi" 2>/dev/null
|
||||||
VBoxManage closemedium "Install ${macOS_release_name}.vdi" 2>/dev/null
|
VBoxManage closemedium "Install ${macOS_release_name}.vdi" 2>/dev/null
|
||||||
printf 'Temporary files are safe to delete. '"${white_on_red}"'Delete temporary files?'"${default_color}"
|
printf 'Temporary files are safe to delete. '"${white_on_red}"'Delete temporary files?'"${default_color}"
|
||||||
@@ -948,13 +969,12 @@ if [ "${delete,,}" == "y" ]; then
|
|||||||
"Install ${macOS_release_name}.vdi" \
|
"Install ${macOS_release_name}.vdi" \
|
||||||
"ApfsDriverLoader.efi" "AppleImageLoader.efi" \
|
"ApfsDriverLoader.efi" "AppleImageLoader.efi" \
|
||||||
"AppleSupport-v2.0.4-RELEASE.zip" "AppleUiSupport.efi" \
|
"AppleSupport-v2.0.4-RELEASE.zip" "AppleUiSupport.efi" \
|
||||||
"startup.nsh"
|
"startup.nsh" 2>/dev/null
|
||||||
rm "dmg2img.exe" 2>/dev/null
|
rm "dmg2img.exe" 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf 'macOS installation should complete in a few minutes.
|
printf '
|
||||||
|
When the virtual machine is shut down, the virtual disk image may be increased
|
||||||
After the installation is complete, the virtual disk image may be increased
|
|
||||||
through VirtualBox, and then the macOS system APFS container size may be
|
through VirtualBox, and then the macOS system APFS container size may be
|
||||||
increased. Inside the virtual machine run "sudo diskutil repairDisk disk0"
|
increased. Inside the virtual machine run "sudo diskutil repairDisk disk0"
|
||||||
and then from Disk Utility delete the "Free space" partition, allowing the
|
and then from Disk Utility delete the "Free space" partition, allowing the
|
||||||
|
|||||||
Reference in New Issue
Block a user