mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
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:
parent
5b74011219
commit
6ea4fa812f
2 changed files with 33 additions and 20 deletions
46
quickemu
46
quickemu
|
@ -1,17 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
export LC_ALL=C
|
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() {
|
function disk_delete() {
|
||||||
if [ -e "${disk_img}" ]; then
|
if [ -e "${disk_img}" ]; then
|
||||||
rm "${disk_img}"
|
rm "${disk_img}"
|
||||||
|
@ -147,6 +136,7 @@ function vm_boot() {
|
||||||
local GL="on"
|
local GL="on"
|
||||||
local GUEST_TWEAKS=""
|
local GUEST_TWEAKS=""
|
||||||
local HOST_CPU=""
|
local HOST_CPU=""
|
||||||
|
local MAC_MISSING=""
|
||||||
local NET_DEVICE="virtio-net"
|
local NET_DEVICE="virtio-net"
|
||||||
local OSK=""
|
local OSK=""
|
||||||
local QEMU_VER=""
|
local QEMU_VER=""
|
||||||
|
@ -162,21 +152,37 @@ function vm_boot() {
|
||||||
# Always Boot macOS using EFI
|
# Always Boot macOS using EFI
|
||||||
if [ "${guest_os}" == "macos" ]; then
|
if [ "${guest_os}" == "macos" ]; then
|
||||||
boot="efi"
|
boot="efi"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${guest_os}" == "macos" ]; then
|
|
||||||
echo " - BOOT: EFI"
|
echo " - BOOT: EFI"
|
||||||
web_get "https://github.com/kholia/OSX-KVM/raw/master/OpenCore-Catalina/OpenCore.qcow2"
|
if [ -e "${VMDIR}/OVMF_CODE.fd" ] && [ -e "${VMDIR}/OVMF_VARS-1024x768.fd" ]; then
|
||||||
web_get "https://github.com/kholia/OSX-KVM/raw/master/OVMF_CODE.fd"
|
local EFI_CODE="${VMDIR}/OVMF_CODE.fd"
|
||||||
web_get "https://github.com/kholia/OSX-KVM/raw/master/OVMF_VARS-1024x768.fd"
|
local EFI_VARS="${VMDIR}/OVMF_VARS-1024x768.fd"
|
||||||
local EFI_CODE="${VMDIR}/OVMF_CODE.fd"
|
else
|
||||||
local EFI_VARS="${VMDIR}/OVMF_VARS-1024x768.fd"
|
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
|
elif [[ "${boot}" == *"efi"* ]]; then
|
||||||
if [ -e "/usr/share/OVMF/OVMF_CODE_4M.fd" ]; then
|
if [ -e "/usr/share/OVMF/OVMF_CODE_4M.fd" ]; then
|
||||||
echo " - BOOT: EFI"
|
echo " - BOOT: EFI"
|
||||||
local EFI_CODE="/usr/share/OVMF/OVMF_CODE_4M.fd"
|
local EFI_CODE="/usr/share/OVMF/OVMF_CODE_4M.fd"
|
||||||
local EFI_VARS="${VMDIR}/OVMF_VARS_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}"
|
cp "/usr/share/OVMF/OVMF_VARS_4M.fd" "${EFI_VARS}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
7
quickget
7
quickget
|
@ -205,6 +205,13 @@ function get_macos() {
|
||||||
|
|
||||||
make_vm_dir
|
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
|
if [ ! -e "${VM_PATH}/RecoveryImage.chunklist" ]; then
|
||||||
echo "Downloading ${RELEASE}..."
|
echo "Downloading ${RELEASE}..."
|
||||||
${MACRECOVERY} \
|
${MACRECOVERY} \
|
||||||
|
|
Loading…
Reference in a new issue