From df57ed1a68ef88eb165772741c4c1bef75517470 Mon Sep 17 00:00:00 2001 From: Liam <33645555+lj3954@users.noreply.github.com> Date: Sun, 24 Dec 2023 01:24:41 -0600 Subject: [PATCH] Implement download_iso for Windows & macOS --- README.md | 11 ++++++----- quickget | 39 +++++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index bd999b8..1efdcfa 100644 --- a/README.md +++ b/README.md @@ -259,15 +259,16 @@ You can also use `quickget` with options to: ``` shell # show an OS ISO download URL for {os} {release} [edition] 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 # open an OS distribution homepage in a browser 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 -`Windows` (`quickget` will begin downloading the requested release and -edition of windows) +The `--show-iso-url`, `--test-iso-url`, and `--download-iso` options are fully +functional for all operating systems, including Windows and macOS. ## Other Operating Systems @@ -462,7 +463,7 @@ There are some considerations when running macOS via Quickemu. - Big Sur - Monterey - Ventura - - Sonoma (Not recommended) + - Sonoma - `quickemu` will automatically download the required [OpenCore](https://github.com/acidanthera/OpenCorePkg) bootloader and OVMF firmware from [OSX-KVM](https://github.com/kholia/OSX-KVM). diff --git a/quickget b/quickget index 9066609..b06b6ca 100755 --- a/quickget +++ b/quickget @@ -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=${chunkListSession}" "${chunkListLink}" exit 0 - fi - - 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 + elif [ "${download_iso}" == 'on' ]; 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}" + 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 if [ $skipVerification != true ]; then if ! python3 "${CHUNKCHECK}" "${VM_PATH}" 2> /dev/null; then - echo Verification failed. + echo "Verification failed." exit 1 fi - echo Verified macOS ${RELEASE} image using chunklist. + echo "Verified macOS ${RELEASE} image using chunklist." else - echo Skipping verification of image. + echo "Skipping verification of image." fi 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 fi + rm "${VM_PATH}/RecoveryImage.dmg" "${VM_PATH}/RecoveryImage.chunklist" make_vm_config RecoveryImage.img } @@ -2734,6 +2741,10 @@ function download_windows() { function get_windows() { download_windows "${RELEASE}" + if [ "${download_iso}" == 'on' ]; then + exit 0 + fi + echo "Downloading VirtIO drivers..." web_get "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" "${VM_PATH}"