Don't download macOS firmware/bootloader at runtime

quickget it the tool to acquire macOS with compatible firmware and bootloader. quickemu is backwards compatible with Clover.
This commit is contained in:
Martin Wimpress 2021-09-30 18:59:00 +01:00
parent 5b74011219
commit 6ea4fa812f
No known key found for this signature in database
GPG Key ID: 61DF940515E06DA3
2 changed files with 33 additions and 20 deletions

View File

@ -1,17 +1,6 @@
#!/usr/bin/env bash
export LC_ALL=C
function web_get() {
local URL="${1}"
local FILE=""
FILE="${URL##*/}"
mkdir -p "${VMDIR}" 2>/dev/null
if ! wget --quiet --continue --show-progress --progress=bar:force:noscroll "${URL}" -O "${VMDIR}/${FILE}"; then
echo "ERROR! Failed to download ${URL}"
exit 1
fi
}
function disk_delete() {
if [ -e "${disk_img}" ]; then
rm "${disk_img}"
@ -147,6 +136,7 @@ function vm_boot() {
local GL="on"
local GUEST_TWEAKS=""
local HOST_CPU=""
local MAC_MISSING=""
local NET_DEVICE="virtio-net"
local OSK=""
local QEMU_VER=""
@ -162,21 +152,37 @@ function vm_boot() {
# Always Boot macOS using EFI
if [ "${guest_os}" == "macos" ]; then
boot="efi"
fi
if [ "${guest_os}" == "macos" ]; then
echo " - BOOT: EFI"
web_get "https://github.com/kholia/OSX-KVM/raw/master/OpenCore-Catalina/OpenCore.qcow2"
web_get "https://github.com/kholia/OSX-KVM/raw/master/OVMF_CODE.fd"
web_get "https://github.com/kholia/OSX-KVM/raw/master/OVMF_VARS-1024x768.fd"
local EFI_CODE="${VMDIR}/OVMF_CODE.fd"
local EFI_VARS="${VMDIR}/OVMF_VARS-1024x768.fd"
if [ -e "${VMDIR}/OVMF_CODE.fd" ] && [ -e "${VMDIR}/OVMF_VARS-1024x768.fd" ]; then
local EFI_CODE="${VMDIR}/OVMF_CODE.fd"
local EFI_VARS="${VMDIR}/OVMF_VARS-1024x768.fd"
else
MAC_MISSING="Firmware"
fi
if [ -e "${VMDIR}/OpenCore.qcow2" ]; then
local MAC_BOOTLOADER="${VMDIR}/OpenCore.qcow2"
elif [ -e "${VMDIR}/ESP.qcow2" ]; then
# Backwards compatibility for Clover
local MAC_BOOTLOADER="${VMDIR}/ESP.qcow2"
else
MAC_MISSING="Bootloader"
fi
if [ -n "${MAC_MISSING}" ]; then
echo "ERROR! macOS ${MAC_MISSING} was not found."
echo " Use 'quickget' to download the required files."
exit 1
fi
elif [[ "${boot}" == *"efi"* ]]; then
if [ -e "/usr/share/OVMF/OVMF_CODE_4M.fd" ]; then
echo " - BOOT: EFI"
local EFI_CODE="/usr/share/OVMF/OVMF_CODE_4M.fd"
local EFI_VARS="${VMDIR}/OVMF_VARS_4M.fd"
if [ ! -e "${EFI_VARS}" ]; then
if [ -e "${VMDIR}/${VMNAME}-vars.fd" ]; then
# Preserve backward compatibility
mv "${VMDIR}/${VMNAME}-vars.fd" "${EFI_VARS}"
elif [ ! -e "${EFI_VARS}" ]; then
cp "/usr/share/OVMF/OVMF_VARS_4M.fd" "${EFI_VARS}"
fi
else

View File

@ -205,6 +205,13 @@ function get_macos() {
make_vm_dir
# Get firmware
web_get "https://github.com/kholia/OSX-KVM/raw/master/OpenCore-Catalina/OpenCore.qcow2" "${VM_PATH}"
web_get "https://github.com/kholia/OSX-KVM/raw/master/OVMF_CODE.fd" "${VM_PATH}"
if [ ! -e "${VM_PATH}/OVMF_VARS-1024x768.fd" ]; then
web_get "https://github.com/kholia/OSX-KVM/raw/master/OVMF_VARS-1024x768.fd" "${VM_PATH}"
fi
if [ ! -e "${VM_PATH}/RecoveryImage.chunklist" ]; then
echo "Downloading ${RELEASE}..."
${MACRECOVERY} \