Implement download_iso for Windows & macOS

This commit is contained in:
Liam 2023-12-24 01:24:41 -06:00 committed by Martin Wimpress
parent e43d291b37
commit df57ed1a68
2 changed files with 31 additions and 19 deletions

View File

@ -259,15 +259,16 @@ You can also use `quickget` with options to:
``` shell ``` shell
# show an OS ISO download URL for {os} {release} [edition] # show an OS ISO download URL for {os} {release} [edition]
quickget --show-iso-url fedora 38 Silverblue quickget --show-iso-url fedora 38 Silverblue
# test if and OS ISO is available for {os} {release} [edition] # test if an OS ISO is available for {os} {release} [edition]
quickget --test-iso-url nixos 23.05 plasma5 quickget --test-iso-url nixos 23.05 plasma5
# open an OS distribution homepage in a browser # open an OS distribution homepage in a browser
quickget --open-distro-homepage ubuntu-mate quickget --open-distro-homepage ubuntu-mate
# Only download image file into current directory, without creating VM
quickget --download-iso elementary 7.1
``` ```
The `--show-iso-url` and `--test-iso-url` options **do not** work for The `--show-iso-url`, `--test-iso-url`, and `--download-iso` options are fully
`Windows` (`quickget` will begin downloading the requested release and functional for all operating systems, including Windows and macOS.
edition of windows)
## Other Operating Systems ## Other Operating Systems
@ -462,7 +463,7 @@ There are some considerations when running macOS via Quickemu.
- Big Sur - Big Sur
- Monterey - Monterey
- Ventura - Ventura
- Sonoma (Not recommended) - Sonoma
- `quickemu` will automatically download the required - `quickemu` will automatically download the required
[OpenCore](https://github.com/acidanthera/OpenCorePkg) bootloader [OpenCore](https://github.com/acidanthera/OpenCorePkg) bootloader
and OVMF firmware from [OSX-KVM](https://github.com/kholia/OSX-KVM). and OVMF firmware from [OSX-KVM](https://github.com/kholia/OSX-KVM).

View File

@ -1764,29 +1764,35 @@ function get_macos() {
wget --spider --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${downloadSession}" "${downloadLink}" wget --spider --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${downloadSession}" "${downloadLink}"
wget --spider --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${chunkListSession}" "${chunkListLink}" wget --spider --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${chunkListSession}" "${chunkListLink}"
exit 0 exit 0
fi elif [ "${download_iso}" == 'on' ]; then
echo Downloading macOS firmware
web_get "${OpenCore_qcow2}" "${VM_PATH}"
web_get "${OVMF_CODE}" "${VM_PATH}"
if [ ! -e "${VM_PATH}/OVMF_VARS-1920x1080.fd" ]; then
web_get "${OVMF_VARS}" "${VM_PATH}"
fi
if [ ! -e "${VM_PATH}/RecoveryImage.chunklist" ]; then
echo "Downloading macOS ${RELEASE} from ${downloadLink}" echo "Downloading macOS ${RELEASE} from ${downloadLink}"
web_get "${downloadLink}" "${VM_PATH}" RecoveryImage.dmg --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${downloadSession}" web_get "${downloadLink}" "${VM_PATH}" RecoveryImage.dmg --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${downloadSession}"
curl --progress-bar "${chunkListLink}" -o "${VM_PATH}/RecoveryImage.chunklist" --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${chunkListSession}" curl --progress-bar "${chunkListLink}" -o RecoveryImage.chunklist --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${chunkListSession}"
VM_PATH="$(pwd)"
else
echo "Downloading macOS firmware"
web_get "${OpenCore_qcow2}" "${VM_PATH}"
web_get "${OVMF_CODE}" "${VM_PATH}"
if [ ! -e "${VM_PATH}/OVMF_VARS-1920x1080.fd" ]; then
web_get "${OVMF_VARS}" "${VM_PATH}"
fi
if [ ! -e "${VM_PATH}/RecoveryImage.chunklist" ]; then
echo "Downloading macOS ${RELEASE} from ${downloadLink}"
web_get "${downloadLink}" "${VM_PATH}" RecoveryImage.dmg --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${downloadSession}"
curl --progress-bar "${chunkListLink}" -o "${VM_PATH}/RecoveryImage.chunklist" --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${chunkListSession}"
fi
fi fi
if [ $skipVerification != true ]; then if [ $skipVerification != true ]; then
if ! python3 "${CHUNKCHECK}" "${VM_PATH}" 2> /dev/null; then if ! python3 "${CHUNKCHECK}" "${VM_PATH}" 2> /dev/null; then
echo Verification failed. echo "Verification failed."
exit 1 exit 1
fi fi
echo Verified macOS ${RELEASE} image using chunklist. echo "Verified macOS ${RELEASE} image using chunklist."
else else
echo Skipping verification of image. echo "Skipping verification of image."
fi fi
if [ -e "${VM_PATH}/RecoveryImage.dmg" ] && [ ! -e "${VM_PATH}/RecoveryImage.img" ]; then if [ -e "${VM_PATH}/RecoveryImage.dmg" ] && [ ! -e "${VM_PATH}/RecoveryImage.img" ]; then
@ -1794,6 +1800,7 @@ function get_macos() {
qemu-img convert "${VM_PATH}/RecoveryImage.dmg" -O raw "${VM_PATH}/RecoveryImage.img" 2>/dev/null qemu-img convert "${VM_PATH}/RecoveryImage.dmg" -O raw "${VM_PATH}/RecoveryImage.img" 2>/dev/null
fi fi
rm "${VM_PATH}/RecoveryImage.dmg" "${VM_PATH}/RecoveryImage.chunklist"
make_vm_config RecoveryImage.img make_vm_config RecoveryImage.img
} }
@ -2734,6 +2741,10 @@ function download_windows() {
function get_windows() { function get_windows() {
download_windows "${RELEASE}" download_windows "${RELEASE}"
if [ "${download_iso}" == 'on' ]; then
exit 0
fi
echo "Downloading VirtIO drivers..." echo "Downloading VirtIO drivers..."
web_get "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" "${VM_PATH}" web_get "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" "${VM_PATH}"