diff --git a/README.md b/README.md index a973d9d..44d2e60 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,12 @@ comprehensive support for macOS and Windows**. * **macOS** Monterey, Big Sur, Catalina, Mojave & High Sierra * **Windows** 8.1, 10 and 11 including TPM 2.0 * [Ubuntu](https://ubuntu.com/desktop) and all the **[official Ubuntu flavours](https://ubuntu.com/download/flavours)** + * [Debian](https://www.debian.org/) (bullseye with all the official and non-free DE variants) * [Fedora](https://getfedora.org/) & openSUSE ([Leap](https://get.opensuse.org/leap/), [Tumbleweed](https://get.opensuse.org/tumbleweed/), [MicroOS](https://microos.opensuse.org/)) + * [Alma Linux](https://almalinux.org/) * [Linux Mint](https://linuxmint.com/) (Cinnamon, MATE, and XFCE), [elementary OS](https://elementary.io/), [Pop!_OS](https://pop.system76.com/) - * [Arch Linux](https://www.archlinux.org/), [Kali](https://www.kali.org/),[Garuda](https://garudalinux.org/), [ZorinOS](https://zorin.com/os/), [NixOS](https://nixos.org/) & [Gentoo Linux](https://www.gentoo.org/) + * [Arch Linux](https://www.archlinux.org/), [Kali](https://www.kali.org/),[Garuda](https://garudalinux.org/), [ZorinOS](https://zorin.com/os/), [NixOS](https://nixos.org/), [Gentoo Linux](https://www.gentoo.org/), + * [Oracle Linux](https://www.oracle.com/linux/) and [Rocky Linux](https://rockylinux.org/) * [Regolith Linux](https://regolith-linux.org/) (Release 1.6 and latest 2.0.0 pre-release ) * [FreeBSD](https://www.freebsd.org/) & [OpenBSD](https://www.openbsd.org/) * Full SPICE support including host/guest clipboard sharing @@ -173,21 +176,22 @@ preferred flavour. `quickget` also supports: + * `alma` * `archlinux` + * `debian` * `elementary` * `fedora` * `garuda` * `gentoo` * `kali` - * `linuxmint-cinnamon` - * `linuxmint-mate` - * `linuxmint-xfce` + * `kdeneon` + * `linuxmint` + * `nixos` * `opensuse` + * `oraclelinux` * `popos` * `regolith` - * `nixos-gnome` - * `nixos-plasma5` - * `nixos-minimal` + * `rockylinux` * `zorin` Or you can download a Linux image and manually create a VM configuration. @@ -212,6 +216,13 @@ quickemu --vm debian-bullseye.conf * Install the SPICE agent (`spice-vdagent`) to enable copy/paste and USB redirection. * Install the SPICE WebDAV agent (`spice-webdavd`) to enable file sharing. +## BSD Guests + +`quickget` also supports: + + * `freebsd` + * `openbsd` + ## macOS Guest `quickget` automatically downloads a macOS recovery image and creates a virtual @@ -498,8 +509,9 @@ Usage quickemu --vm ubuntu.conf You can also pass optional parameters - --delete : Delete the disk image. - --display : Select display backend. 'sdl' (default), 'gtk', 'none' or 'spice' + --delete-disk : Delete the disk image and EFI variables + --delete-vm : Delete the entire VM and it's configuration + --display : Select display backend. 'sdl' (default), 'gtk', 'none', or 'spice' --fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit) --ignore-msrs-always : Configure KVM to always ignore unhandled machine-specific registers --screen : Use specified screen to determine the window size. diff --git a/quickemu b/quickemu index 276c045..5507580 100755 --- a/quickemu +++ b/quickemu @@ -37,7 +37,15 @@ function ignore_msrs_alert() { fi } -function disk_delete() { +function delete_shortcut() { + local SHORTCUT_DIR="${HOME}/.local/share/applications/" + if [ -e "${SHORTCUT_DIR}/${VMNAME}.desktop" ]; then + rm "${SHORTCUT_DIR}/${VMNAME}.desktop" + echo "Deleted ${VM} desktop shortcut" + fi +} + +function delete_disk() { if [ -e "${disk_img}" ]; then rm "${disk_img}" # Remove any EFI vars, but not for macOS @@ -46,14 +54,20 @@ function disk_delete() { rm "${VMDIR}/${VMNAME}-vars.fd" >/dev/null 2>&1 rm "${VMPATH}/${VMDIR}/${VMNAME}-vars.fd" > /dev/null 2>&1 echo "SUCCESS! Deleted ${disk_img}" + delete_shortcut else echo "NOTE! ${disk_img} not found. Doing nothing." fi +} - local SHORTCUT_DIR="${HOME}/.local/share/applications/" - if [ -e "${SHORTCUT_DIR}/${VMNAME}.desktop" ]; then - rm "${SHORTCUT_DIR}/${VMNAME}.desktop" - echo "Deleted ${VM} desktop shortcut" +function delete_vm() { + if [ -d "${VMDIR}" ]; then + rm -rf "${VMDIR}" + rm "${VM}" + echo "SUCCESS! Deleted ${VM} and ${VMDIR}" + delete_shortcut + else + echo "NOTE! ${VMDIR} not found. Doing nothing." fi } @@ -122,8 +136,9 @@ function get_port() { local PORT_RANGE=$((PORT_START+$2)) local PORT for ((PORT = PORT_START; PORT <= PORT_RANGE; PORT++)); do - (echo -n "" >/dev/tcp/127.0.0.1/"${PORT}") >/dev/null 2>&1 - if [ ${?} -ne 0 ]; then + # Make sure port scans do not block too long. + timeout 0.1s bash -c "echo >/dev/tcp/127.0.0.1/${PORT}" >/dev/null 2>&1 + if [ ${?} -eq 1 ]; then echo "${PORT}" break fi @@ -465,6 +480,10 @@ function vm_boot() { exit 1 fi + OSK=$(echo "bheuneqjbexolgurfrjbeqfthneqrqcyrnfrqbagfgrny(p)NccyrPbzchgreVap" | tr 'A-Za-z' 'N-ZA-Mn-za-m') + # Disable S3 support in the VM to prevent macOS suspending during install + GUEST_TWEAKS="-no-hpet -global kvm-pit.lost_tick_policy=discard -global ICH9-LPC.disable_s3=1 -device isa-applesmc,osk=${OSK}" + # Tune Qemu optimisations based on the macOS release, or fallback to lowest # common supported options if none is specified. # * VirtIO Block Media doesn't work in High Sierra (at all) or the Mojave (Recovery Image) @@ -482,7 +501,8 @@ function vm_boot() { BALLOON="-device virtio-balloon" MAC_DISK_DEV="virtio-blk-pci" NET_DEVICE="virtio-net" - USB_HOST_PASSTHROUGH_CONTROLLER="qemu-xhci" + USB_HOST_PASSTHROUGH_CONTROLLER="nec-usb-xhci" + GUEST_TWEAKS="${GUEST_TWEAKS} -global nec-usb-xhci.msi=off" ;; *) # Backwards compatibility if no macos_release is specified. @@ -493,8 +513,7 @@ function vm_boot() { USB_HOST_PASSTHROUGH_CONTROLLER="usb-ehci" ;; esac - OSK=$(echo "bheuneqjbexolgurfrjbeqfthneqrqcyrnfrqbagfgrny(p)NccyrPbzchgreVap" | tr 'A-Za-z' 'N-ZA-Mn-za-m') - GUEST_TWEAKS="-no-hpet -global kvm-pit.lost_tick_policy=discard -device isa-applesmc,osk=${OSK}" + if [ -z "${disk_size}" ]; then disk_size="96G" fi @@ -508,9 +527,7 @@ function vm_boot() { # Disable S3 support in the VM to ensure Windows can boot with SecureBoot enabled # - https://wiki.archlinux.org/title/QEMU#VM_does_not_boot_when_using_a_Secure_Boot_enabled_OVMF - if [ "${secureboot}" == "on" ]; then - GUEST_TWEAKS="${GUEST_TWEAKS} -global ICH9-LPC.disable_s3=1" - fi + GUEST_TWEAKS="${GUEST_TWEAKS} -global ICH9-LPC.disable_s3=1" if [ -z "${disk_size}" ]; then disk_size="64G" @@ -819,7 +836,7 @@ function vm_boot() { -enable-kvm -machine q35,smm=${SMM},vmport=off ${GUEST_TWEAKS} ${CPU} ${SMP} -m ${RAM_VM} ${BALLOON} - -smbios type=2,manufacturer="Wimpys World",product="Quickemu",version="${VERSION}",serial="jvzclfjbeyq.pbz",location="wimpysworld.com",asset="${VMNAME}" + -smbios type=2,manufacturer="Quickemu Project",product="Quickemu",version="${VERSION}",serial="0xDEADBEEF",location="quickemu.com",asset="${VMNAME}" ${VIDEO} -display ${DISPLAY_RENDER} -device usb-ehci,id=input -device usb-kbd,bus=input.0 @@ -874,38 +891,20 @@ function vm_boot() { args+=(-drive if=floppy,format=raw,file="${floppy}") fi - if [ "${guest_os}" == "windows" ]; then - # shellcheck disable=SC2054 - args+=(-device ahci,id=ahci) - fi - if [ -n "${iso}" ]; then - if [ "${guest_os}" == "windows" ]; then - # shellcheck disable=SC2054 - args+=(-drive id=iso,if=none,media=cdrom,file="${iso}" - -device ide-cd,drive=iso,bus=ahci.1,bootindex=1) - else - # shellcheck disable=SC2054 - args+=(-drive media=cdrom,index=0,file="${iso}") - fi + # shellcheck disable=SC2054 + args+=(-drive media=cdrom,index=0,file="${iso}") fi if [ -n "${fixed_iso}" ]; then - if [ "${guest_os}" == "windows" ]; then - # shellcheck disable=SC2054 - args+=(-drive id=fixed_iso,if=none,media=cdrom,file="${fixed_iso}" - -device ide-cd,drive=fixed_iso,bus=ahci.2) - else - # shellcheck disable=SC2054 - args+=(-drive media=cdrom,index=1,file="${fixed_iso}") - fi + # shellcheck disable=SC2054 + args+=(-drive media=cdrom,index=1,file="${fixed_iso}") fi # Attach the unattended configuration to Windows guests when booting from ISO if [ -n "${iso}" ] && [ "${guest_os}" == "windows" ] && [ -e "${VMDIR}/unattended.iso" ]; then # shellcheck disable=SC2054 - args+=(-drive id=unattended,if=none,media=cdrom,file="${VMDIR}/unattended.iso" - -device ide-cd,drive=unattended,bus=ahci.3) + args+=(-drive media=cdrom,index=2,file="${VMDIR}/unattended.iso") fi if [ "${guest_os}" == "macos" ]; then @@ -923,10 +922,6 @@ function vm_boot() { # shellcheck disable=SC2054,SC2206 args+=(-device ${MAC_DISK_DEV},drive=SystemDisk -drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO}) - elif [ "${guest_os}" == "windows" ]; then - # shellcheck disable=SC2054,SC2206 - args+=(-device ide-hd,drive=SystemDisk,bus=ahci.0,bootindex=0 - -drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO}) else # shellcheck disable=SC2054,SC2206 args+=(-device virtio-blk-pci,drive=SystemDisk @@ -954,12 +949,13 @@ function vm_boot() { -device tpm-tis,tpmdev=tpm0) fi - # The OSK parameter contains parenthesis, they need to be escaped in the shell scripts - # The vendor name, Wimpys World, contains a space. It needs to be double-quoted. + # The OSK parameter contains parenthesis, they need to be escaped in the shell + # scripts. The vendor name, Quickemu Project, contains a space. It needs to be + # double-quoted. SHELL_ARGS="${args[*]}" SHELL_ARGS="${SHELL_ARGS//(/\\(}" SHELL_ARGS="${SHELL_ARGS//)/\\)}" - SHELL_ARGS="${SHELL_ARGS//Wimpys World/\"Wimpys World\"}" + SHELL_ARGS="${SHELL_ARGS//Quickemu Project/\"Quickemu Project\"}" echo "${QEMU}" "${SHELL_ARGS}" >> "${VMDIR}/${VMNAME}.sh" ${QEMU} "${args[@]}" > "${VMDIR}/${VMNAME}.log" & @@ -1002,7 +998,8 @@ function usage() { echo " ${LAUNCHER} --vm ubuntu.conf" echo echo "You can also pass optional parameters" - echo " --delete : Delete the disk image." + echo " --delete-disk : Delete the disk image and EFI variables" + echo " --delete-vm : Delete the entire VM and it's configuration" echo " --display : Select display backend. 'sdl' (default), 'gtk', 'none', or 'spice'" echo " --fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)" echo " --ignore-msrs-always : Configure KVM to always ignore unhandled machine-specific registers" @@ -1017,6 +1014,16 @@ function usage() { exit 1 } +function display_param_check() { + if [ "${OUTPUT}" != "gtk" ] && [ "${OUTPUT}" != "none" ] && [ "${OUTPUT}" != "sdl" ] && [ "${OUTPUT}" != "spice" ]; then + echo "ERROR! Requested output '${OUTPUT}' is not recognised." + exit 1 + elif [ "${OUTPUT}" == "spice" ] && ! command -v spicy &>/dev/null; then + echo "ERROR! Requested SPICE display, but 'spicy' is not installed." + exit 1 + fi +} + # Lowercase variables are used in the VM config file only boot="efi" bridge="" @@ -1036,10 +1043,11 @@ secureboot="off" tpm="off" usb_devices=() -DELETE=0 +DELETE_DISK=0 +DELETE_VM=0 FULLSCREEN="" FULLSPICY="" -OUTPUT="sdl" +OUTPUT="" PUBLIC="" PUBLIC_PERMS="" PUBLIC_TAG="" @@ -1056,7 +1064,7 @@ VMPATH="" readonly LAUNCHER=$(basename "${0}") readonly DISK_MIN_SIZE=$((197632 * 8)) -readonly VERSION="2.3.2" +readonly VERSION="3.11" # PUBLICSHARE is the only directory exposed to guest VMs for file # sharing via 9P, spice-webdavd and Samba. This path is not configurable. @@ -1078,7 +1086,7 @@ fi QEMU=$(command -v qemu-system-x86_64) QEMU_IMG=$(command -v qemu-img) if [ ! -e "${QEMU}" ] && [ ! -e "${QEMU_IMG}" ]; then - echo "ERROR! qemu not found. Please install qemu." + echo "ERROR! QEMU not found. Please make install qemu-system-x86_64 and qemu-img" exit 1 fi @@ -1096,18 +1104,15 @@ if [ $# -lt 1 ]; then else while [ $# -gt 0 ]; do case "${1}" in - -delete|--delete) - DELETE=1 + -delete|--delete|-delete-disk|--delete-disk) + DELETE_DISK=1 + shift;; + -delete-vm|--delete-vm) + DELETE_VM=1 shift;; -display|--display) OUTPUT="${2}" - if [ "${OUTPUT}" != "gtk" ] && [ "${OUTPUT}" != "none" ] && [ "${OUTPUT}" != "sdl" ] && [ "${OUTPUT}" != "spice" ]; then - echo "ERROR! Requested output '${OUTPUT}' is not recognised." - exit 1 - elif [ "${OUTPUT}" == "spice" ] && ! command -v spicy &>/dev/null; then - echo "ERROR! Requested SPICE display, but 'spicy' is not installed." - exit 1 - fi + display_param_check shift shift;; -fullscreen|--fullscreen|-full-screen|--full-screen) @@ -1179,6 +1184,15 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then disk_size="${disk}" fi + if [ -z "${OUTPUT}" ]; then + if [ -z "${display}" ]; then + OUTPUT="sdl" + else + OUTPUT="${display}" + display_param_check + fi + fi + if [ "${tpm}" == "on" ]; then SWTPM=$(command -v swtpm) if [ ! -e "${SWTPM}" ]; then @@ -1191,8 +1205,13 @@ else usage fi -if [ ${DELETE} -eq 1 ]; then - disk_delete +if [ ${DELETE_DISK} -eq 1 ]; then + delete_disk + exit +fi + +if [ ${DELETE_VM} -eq 1 ]; then + delete_vm exit fi diff --git a/quickget b/quickget index d7d1497..299fa02 100755 --- a/quickget +++ b/quickget @@ -1,5 +1,6 @@ #!/usr/bin/env bash + # Here the quick 'n dirty guide to adding a new OS to quickget # # 1. Add the new OS, all lowercase, to os_support() @@ -25,7 +26,7 @@ function cleanup() { if [ -n "$(jobs -p)" ]; then - kill $(jobs -p) + kill "$(jobs -p)" fi } @@ -34,6 +35,7 @@ function pretty_name() { local PRETTY_NAME="" SIMPLE_NAME="${1}" case ${SIMPLE_NAME} in + alma) PRETTY_NAME="Alma Linux";; android) PRETTY_NAME="Android x86";; archlinux) PRETTY_NAME="Arch Linux";; elementary) PRETTY_NAME="elementary OS";; @@ -50,6 +52,7 @@ function pretty_name() { macos) PRETTY_NAME="macOS";; openbsd) PRETTY_NAME="OpenBSD";; opensuse) PRETTY_NAME="openSUSE";; + oraclelinux) PRETTY_NAME="Oracle Linux";; popos) PRETTY_NAME="Pop!_OS";; regolith) PRETTY_NAME="Regolith Linux";; rockylinux) PRETTY_NAME="Rocky Linux";; @@ -143,6 +146,14 @@ function list_csv() { for OPTION in intel nvidia; do echo "${DISPLAY_NAME},${OS},${RELEASE},${OPTION},${DOWNLOADER},${PNG},${SVG}" done + elif [ "${OS}" == "debian" ]; then + for OPTION in standard nonfree; do + echo "${DISPLAY_NAME},${OS},${RELEASE},${OPTION},${DOWNLOADER},${PNG},${SVG}" + done + elif [ "${OS}" == "alma" ]; then + for OPTION in minimal dvd; do + echo "${DISPLAY_NAME},${OS},${RELEASE},${OPTION},${DOWNLOADER},${PNG},${SVG}" + done else echo "${DISPLAY_NAME},${OS},${RELEASE},,${DOWNLOADER},${PNG},${SVG}" fi @@ -152,8 +163,10 @@ function list_csv() { } function os_support() { - echo android \ + echo alma \ + android \ archlinux \ + debian \ elementary \ freebsd \ fedora \ @@ -172,6 +185,7 @@ function os_support() { macos \ openbsd \ opensuse \ + oraclelinux \ popos \ regolith \ rockylinux \ @@ -186,6 +200,12 @@ function os_support() { zorin } +function releases_alma() { + # consider flavours for boot and dvd as well as + echo 8.4 \ + 8.5 +} + function releases_android() { echo 9.0 \ 8.1 \ @@ -201,6 +221,19 @@ function releases_archlinux() { echo latest } +# later refactor these DE variants like languages and avoid the arch ? +# all these are available with a "nonfree" option too +function releases_debian() { + echo 11.1.0-amd64-cinnamon \ + 11.1.0-amd64-gnome \ + 11.1.0-amd64-kde \ + 11.1.0-amd64-lxde \ + 11.1.0-amd64-lxqt \ + 11.1.0-amd64-mate \ + 11.1.0-amd64-standard \ + 11.1.0-amd64-xfce +} + function releases_elementary() { echo 6.0 } @@ -254,7 +287,8 @@ function releases_linuxmint(){ } function releases_nixos(){ - echo 21.05 + echo 21.05 \ + 21.11 } function releases_openbsd(){ @@ -270,6 +304,16 @@ function releases_opensuse(){ tumbleweed } +function releases_oraclelinux() { + echo 8.5 \ + 8.4 \ + 8.3 \ + 8.2 \ + 7.9 \ + 7.8 \ + 7.7 +} + function releases_macos() { echo high-sierra \ mojave \ @@ -373,199 +417,6 @@ function releases_zorin() { 15edulite32 } -function unattended_windows() { - cat << 'EOF' > "${1}" - - - - - - - - - true - - - - - - - - 0 - true - - - 1 - EFI - 100 - - - 2 - MSR - 512 - - - 3 - Primary - true - - - - - 1 - 1 - - FAT32 - - - 2 - 3 - - C - NTFS - - - - OnError - - - - OnError - - 0 - 3 - - - - - true - - VK7JG-NPHTM-C97JM-9MPGT-3V66T - Never - - - - true - Never - - - - - - - - - E:\qemufwcfg\w10\amd64 - - - E:\vioinput\w10\amd64 - - - E:\vioscsi\w10\amd64 - - - E:\viostor\w10\amd64 - - - E:\vioserial\w10\amd64 - - - E:\qxldod\w10\amd64 - - - E:\amd64\w10 - - - E:\viogpudo\w10\amd64 - - - E:\viorng\w10\amd64 - - - E:\NetKVM\w10\amd64 - - - E:\viofs\w10\amd64 - - - E:\Balloon\w10\amd64 - - - - - - - - * - - Wimpys World - Quickemu - 24/7 - - Wimpys World - https://github.com/wimpysworld/quickemu/issues - - Wimpys World - - - - - - - true - true - - - - msiexec /i E:\guest-agent\qemu-ga-x86_64.msi /quiet /passive /qn - Install Virtio Guest Agent - 1 - - - msiexec /i F:\spice-webdavd-x64-latest.msi /quiet /passive /qn - Install spice-webdavd file sharing agent - 2 - - - msiexec /i F:\UsbDk_1.0.22_x64.msi /quiet /passive /qn - Install usbdk USB sharing agent - 3 - - - msiexec /i F:\spice-vdagent-x64-0.10.0.msi /quiet /passive /qn - Install spice-vdagent SPICE agent - 4 - - - - - -EOF -} - function check_hash() { local iso="" local hash="" @@ -667,12 +518,18 @@ function make_vm_config() { IMAGE_FILE="${1}" ISO_FILE="${2}" - if [ "${OS}" == "android" ]; then + if [ "${OS}" == "alma" ]; then + GUEST="linux" + IMAGE_TYPE="iso" + elif [ "${OS}" == "android" ]; then GUEST="linux" IMAGE_TYPE="iso" elif [ "${OS}" == "archlinux" ]; then GUEST="linux" IMAGE_TYPE="iso" + elif [ "${OS}" == "debian" ]; then + GUEST="linux" + IMAGE_TYPE="iso" elif [ "${OS}" == "elementary" ]; then GUEST="linux" IMAGE_TYPE="iso" @@ -706,6 +563,9 @@ function make_vm_config() { elif [ "${OS}" == "opensuse" ]; then GUEST="linux" IMAGE_TYPE="iso" + elif [ "${OS}" == "oraclelinux" ]; then + GUEST="linux" + IMAGE_TYPE="iso" elif [ "${OS}" == "popos" ]; then GUEST="linux" IMAGE_TYPE="iso" @@ -732,6 +592,11 @@ function make_vm_config() { IMAGE_TYPE="iso" fi + + if [ -n "${ISOTYPE}" ]; then + RELEASE=${RELEASE}-${ISOTYPE} + fi + if [ ! -e "${OS}-${RELEASE}.conf" ]; then echo "Making VM configuration for ${OS}-${RELEASE}..." cat << EOF > "${OS}-${RELEASE}.conf" @@ -742,7 +607,9 @@ EOF if [ -n "${ISO_FILE}" ]; then echo "fixed_iso=\"${VM_PATH}/${ISO_FILE}\"" >> "${OS}-${RELEASE}.conf" fi - + if [ "${OS}" == "alma" ] && [ ${ISOTYPE} == "dvd" ]; then + echo "disk_size=\"32G\"" >> "${OS}-${RELEASE}.conf" + fi if [ "${OS}" == "openbsd" ]; then echo "boot=\"legacy\"" >> "${OS}-${RELEASE}.conf" fi @@ -755,6 +622,10 @@ EOF echo "disk_size=\"32G\"" >> "${OS}-${RELEASE}.conf" fi + if [ "${OS}" == "oraclelinux" ]; then + echo "disk_size=\"20G\"" >> "${OS}-${RELEASE}.conf" + fi + if [ "${OS}" == "zorin" ]; then case ${RELEASE} in 15education64|15edulite64|15edulite32) @@ -785,16 +656,16 @@ function get_android() { validate_release "releases_android" fosshubVersionInfo=$(wget -O - -q "https://www.fosshub.com/Android-x86-old.html" | grep "var settings =") version="android-x86-${RELEASE}" - releaseJson=$(echo ${fosshubVersionInfo:16} | jq --arg ver "${version}" 'first(.pool.f[] | select((.n | startswith($ver)) and (.n | endswith(".iso"))))') + releaseJson=$(echo "${fosshubVersionInfo:16}" | jq --arg ver "${version}" 'first(.pool.f[] | select((.n | startswith($ver)) and (.n | endswith(".iso"))))') HASH=$(echo "${releaseJson}" | jq -r .hash.sha256) ISO=$(echo "${releaseJson}" | jq -r .n) baseurl="https://mirrors.gigenet.com/OSDN/android-x86/" - releaseFolders=$(wget -q -O - ${baseurl} | grep -o -E [0-9]{5} | uniq) + releaseFolders=$(wget -q -O - ${baseurl} | grep -o -E '[0-9]{5}' | uniq) for item in $releaseFolders; do - file=$(wget -O - -q ${baseurl}${item} | grep "${ISO}") + file=$(wget -O - -q "${baseurl}${item}" | grep "${ISO}") if [[ $file != "" ]]; then URL="${baseurl}${item}/${ISO}" break @@ -805,6 +676,33 @@ function get_android() { make_vm_config "${ISO}" } +function get_alma() { + local HASH="" + local ISO="" + local URL="" + local VERSION="" + #local isotype="" + + validate_release "releases_alma" + + ISOTYPE="minimal" # boot is a step too far for now - needs setting install source to mirror tree ... nope + if [ -n "${1}" ]; then + ISOTYPE="${1}" + fi + + + # The mirror url returns 10 or so local mirrors with some kind or RR rotation/load balancing + # We'll just grab the first + + URL=$(wget -qq -O- "https://mirrors.almalinux.org/isos/x86_64/${RELEASE}.html" | awk -F"
  • |
  • " '{for(i=2;i<=NF;i+=2) {print $i}}' RS="" |grep href|cut -d\" -f2|head -1) + + #VM_PATH="${VM_PATH}"-${ISOTYPE} + ISO=AlmaLinux-${RELEASE}-x86_64-${ISOTYPE}.iso + HASH="$(wget -q -O- "${URL}/CHECKSUM" | grep \(${ISO} | cut -d\ -f4)" + web_get "${URL}/${ISO}" "${VM_PATH}" + check_hash "${ISO}" "${HASH}" + make_vm_config "${ISO}" +} function get_archlinux() { local HASH="" local ISO="" @@ -821,6 +719,35 @@ function get_archlinux() { make_vm_config "${ISO}" } + +function get_debian() { + local HASH="" + local ISO="" + local URL="" + local HASHLINE="" + local FREEDOM="" + + + validate_release "releases_debian" + + if [ "${1}" == "nonfree" ]; then + RELEASE="${RELEASE}+nonfree" + fi + case $RELEASE in + *+nonfree) URL="http://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/current-live/amd64/iso-hybrid" ;; + *) URL="https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid";; + esac + + + HASHLINE=$(wget -q -O- ${URL}/SHA512SUMS |grep ${RELEASE}.iso) + ISO="$(echo ${HASHLINE} | awk '{print $NF}' )" + HASH=$(echo ${HASHLINE} | cut -d\ -f1) + + web_get "${URL}/${ISO}" "${VM_PATH}" + check_hash "${ISO}" "${HASH}" + make_vm_config "${ISO}" +} + function get_elementary() { local ISO="" local URL="" @@ -983,8 +910,8 @@ function get_zorin() { validate_release "releases_zorin" # their redirector returns an href so we need to get that and parse out the iso - URL=$(curl -s https://zrn.co/${RELEASE} |cut -d\" -f2) - ISO=$(echo ${URL}| awk -F\/ ' {print $NF}') + URL=$(curl -s "https://zrn.co/${RELEASE}" |cut -d\" -f2) + ISO=$(echo "${URL}"| awk -F\/ ' {print $NF}') web_get "${URL}" "${VM_PATH}" make_vm_config "${ISO}" } @@ -1056,6 +983,35 @@ function get_opensuse() { make_vm_config "${ISO}" } +function get_oraclelinux() { + local HASH="" + local ISO="" + local URL="" + + local arch="x86_64" + + validate_release "releases_oraclelinux" + + local majorver=${RELEASE::1} + local minorver=${RELEASE:2:1} + + local baseurl="https://yum.oracle.com/ISOS/OracleLinux/OL${majorver}/u${minorver}/${arch}/" + local hashurl="https://linux.oracle.com/security/gpg/checksum/OracleLinux-R${majorver}-U${minorver}-Server-x86_64.checksum" + + if [ "${majorver}" == "8" ]; then + ISO="OracleLinux-R${majorver}-U${minorver}-${arch}-dvd.iso" + else + ISO="OracleLinux-R${majorver}-U${minorver}-Server-${arch}-dvd.iso" + fi + + URL="${baseurl}/${ISO}" + HASH=$(wget -q -O- "${hashurl}" | grep "${ISO}" | cut -d' ' -f1) + + web_get "${URL}" "${VM_PATH}" + check_hash "${ISO}" "${HASH}" + make_vm_config "${ISO}" +} + function get_macos() { local BOARD_ID="" local CWD="" @@ -1168,9 +1124,9 @@ function get_regolith() { 2.0.0_hirsute) URL="${URL}regolith-linux-2.0-hirsute-latest";; esac - ISO="Regolith_"${RELEASE}".iso" + ISO="Regolith_${RELEASE}.iso" web_get "${URL}/${ISO}" "${VM_PATH}" - if [ -n $HASH ]; then + if [ -n "${HASH}" ]; then check_hash "${ISO}" "${HASH}" fi make_vm_config "${ISO}" @@ -1249,7 +1205,7 @@ function get_garuda() { LATEST_URL="${GLDL}/latest/${REL_TYPE}/${RELEASE}/latest.iso.sha256" HASH_URL="$(wget -q -O- ${LATEST_URL})" ISO="$(echo ${HASH_URL} | awk '{print $NF}' )" - HASH=$(echo ${HASH_URL} | cut -d\ -f1) + HASH=$(echo "${HASH_URL}" | cut -d\ -f1) LDATE=$(echo "${ISO}" | awk -F'-' '{print $NF}' |cut -d'.' -f1) # URL="${GLDL}/${REL_TYPE}/${RELEASE}/${LDATE}" @@ -1261,6 +1217,309 @@ function get_garuda() { make_vm_config "${OS}-${RELEASE}.iso" } +function unattended_windows() { + cat << 'EOF' > "${1}" + + + + + + * + + + + + + true + + + + + + false + + + * + + Quickemu Project + Quickemu + 24/7 + + Quickemu Project + https://github.com/quickemu-project/quickemu/issues + + Quickemu Project + + + 0 + + + + + + + false + + + + 0 + true + + + + 1 + Primary + 256 + + + + 2 + EFI + 128 + + + + 3 + MSR + 128 + + + + 4 + Primary + true + + + + + + 1 + 1 + + NTFS + DE94BBA4-06D1-4D40-A16A-BFD50179D6AC + + + + 2 + 2 + + FAT32 + + + + 3 + 3 + + + + 4 + 4 + + C + NTFS + + + + + + true + Never + + + + + 0 + 4 + + false + + + + + 1 + reg add HKLM\System\Setup\LabConfig /v BypassCPUCheck /t REG_DWORD /d 0x00000001 /f + + + 2 + reg add HKLM\System\Setup\LabConfig /v BypassRAMCheck /t REG_DWORD /d 0x00000001 /f + + + 3 + reg add HKLM\System\Setup\LabConfig /v BypassSecureBootCheck /t REG_DWORD /d 0x00000001 /f + + + 4 + reg add HKLM\System\Setup\LabConfig /v BypassTPMCheck /t REG_DWORD /d 0x00000001 /f + + + + false + Never + + + true + + VK7JG-NPHTM-C97JM-9MPGT-3V66T + Never + + + + + + + + + + E:\qemufwcfg\w10\amd64 + + + E:\vioinput\w10\amd64 + + + E:\vioscsi\w10\amd64 + + + E:\viostor\w10\amd64 + + + E:\vioserial\w10\amd64 + + + E:\qxldod\w10\amd64 + + + E:\amd64\w10 + + + E:\viogpudo\w10\amd64 + + + E:\viorng\w10\amd64 + + + E:\NetKVM\w10\amd64 + + + E:\viofs\w10\amd64 + + + E:\Balloon\w10\amd64 + + + + + + + + + true + false + true + false + true + 3 + false + false + + true + + + + + msiexec /i E:\guest-agent\qemu-ga-x86_64.msi /quiet /passive /qn + Install Virtio Guest Agent + 1 + + + msiexec /i F:\spice-webdavd-x64-latest.msi /quiet /passive /qn + Install spice-webdavd file sharing agent + 2 + + + msiexec /i F:\UsbDk_1.0.22_x64.msi /quiet /passive /qn + Install usbdk USB sharing agent + 3 + + + msiexec /i F:\spice-vdagent-x64-0.10.0.msi /quiet /passive /qn + Install spice-vdagent SPICE agent + 4 + + + Cmd /c POWERCFG -H OFF + Disable Hibernation + 5 + + + + + +EOF +} + + +function dbg_windows() { + local DEBUG=0 + if [ ${DEBUG} -eq 1 ]; then + echo "${1}" + fi +} + # Adapted from https://gist.github.com/hongkongkiwi/15a5bf16437315df256c118c163607cb function get_windows() { local ARCH="x64" @@ -1280,34 +1539,47 @@ function get_windows() { validate_release "releases_windows" # Ignore the most recent Windows 10 release for now. - if [ ${RELEASE} -eq 10 ]; then - INDEX=1 + if [ "${RELEASE}" -eq 10 ]; then + INDEX=0 fi if [ "${RELEASE}" -eq 11 ]; then - INDEX=1 + INDEX=0 fi echo "Getting Windows ${RELEASE} URL..." WINDOWS_VERSIONS=$(wget -q -O- "https://tb.rg-adguard.net/php/get_version.php?type_id=1" | jq '.versions | sort_by(-(.version_id | tonumber))') + dbg_windows "${WINDOWS_VERSIONS}" LATEST_WINDOWS_VERSION=$(echo "${WINDOWS_VERSIONS}" | jq -c 'map(select(.name | contains("Windows '${RELEASE}'")))['${INDEX}']') + dbg_windows "${LATEST_WINDOWS_VERSION}" WINDOWS_NAME=$(echo "${LATEST_WINDOWS_VERSION}" | jq -r .name) + dbg_windows "${WINDOWS_NAME}" VERSION_ID=$(echo "${LATEST_WINDOWS_VERSION}" | jq -r .version_id) + dbg_windows "${VERSION_ID}" case ${RELEASE} in 8) EDITION_ID=$(wget -q -O- "https://tb.rg-adguard.net/php/get_edition.php?version_id=${VERSION_ID}&lang=name_${LANG_CODE}" | jq -r '.editions[] | select(.name_'${LANG_CODE}'=="Windows 8.1 Pro + Core").edition_id');; 10|11) EDITION_ID=$(wget -q -O- "https://tb.rg-adguard.net/php/get_edition.php?version_id=${VERSION_ID}&lang=name_${LANG_CODE}" | jq -r '.editions[] | select(.name_'${LANG_CODE}'=="Windows '${RELEASE}'").edition_id');; esac + dbg_windows "${EDITION_ID}" LANGUAGE_ID=$(wget -q -O- "https://tb.rg-adguard.net/php/get_language.php?edition_id=${EDITION_ID}&lang=name_${LANG_CODE}" | jq -r '.languages[] | select(.name_'${LANG_CODE}'=="'"${LANG_NAME}"'").language_id') + dbg_windows "${LANGUAGE_ID}" ARCH_INFO=$(wget -q -O- "https://tb.rg-adguard.net/php/get_arch.php?language_id=${LANGUAGE_ID}") + dbg_windows "${ARCH_INFO}" FILE_NAME=$(echo "${ARCH_INFO}" | jq -r '.archs[] | select(.name | contains("'${ARCH}'")).name') + dbg_windows "${FILE_NAME}" ARCH_ID=$(echo "${ARCH_INFO}" | jq -r '.archs[] | select(.name | contains("'${ARCH}'")).arch_id') + dbg_windows "${ARCH_ID}" DOWNLOAD_INFO=$(wget -q -O- "https://tb.rg-adguard.net/dl.php?fileName=${ARCH_ID}&lang=en") + dbg_windows "${DOWNLOAD_INFO}" DOWNLOAD_SHA1=$(echo "${DOWNLOAD_INFO}" | sed -e 's/<[^>]*>//g' | grep -o -P '(?<=SHA1: ).*(?= expire)' | sed 's/Link//') + dbg_windows "${DOWNLOAD_SHA1}" DOWNLOAD_ID=$(echo "${DOWNLOAD_INFO}" | grep -oP '(?<=https:\/\/tb\.rg-adguard\.net/dl\.php\?go=)[0-9a-z]+') + dbg_windows "${DOWNLOAD_ID}" DOWNLOAD_URL="https://tb.rg-adguard.net/dl.php?go=${DOWNLOAD_ID}" + dbg_windows "${DOWNLOAD_URL}" echo "Downloading ${WINDOWS_NAME}..." web_get "${DOWNLOAD_URL}" "${VM_PATH}" "${FILE_NAME}" @@ -1353,7 +1625,7 @@ if [ -n "${1}" ]; then list_json elif [ "${OS}" == "--version" ] || [ "${OS}" == "-version" ] || [ "${OS}" == "version" ]; then whereIam=$(dirname "${BASH_SOURCE[0]}") - quickemu_version=$( ${whereIam}/quickemu --version) + quickemu_version=$( "${whereIam}"/quickemu --version) echo "Quickemu Version: ${quickemu_version}" exit 0 fi @@ -1367,10 +1639,42 @@ if [ -n "${2}" ]; then RELEASE="${2,,}" VM_PATH="${OS}-${RELEASE}" - if [ "${OS}" == "android" ]; then + if [ "${OS}" == "alma" ]; then + if [ -n "${3}" ]; then + ISOTYPE="${3,,}" + ISOTYPES=(minimal dvd ) # boot) # a step too far + if [[ ! ${ISOTYPES[*]} =~ ${ISOTYPE} ]]; then + echo "iso ${ISOTYPE} is not supported:" + for ISOTYPE in "${ISOTYPES[@]}"; do + echo "${ISOTYPE}" + done + exit 1 + fi + else + ISOTYPE="minimal" + fi + VM_PATH="${OS}-${RELEASE}-${ISOTYPE}" + get_alma "${ISOTYPE}" + elif [ "${OS}" == "android" ]; then get_android elif [ "${OS}" == "archlinux" ]; then get_archlinux + elif [ "${OS}" == "debian" ]; then + if [ -n "${3}" ]; then + FREEDOM="${3}" + FREEDOMS=(standard nonfree) + if [[ ! ${FREEDOMS[*]} =~ ${FREEDOM} ]]; then + echo "ERROR! ${FREEDOM} is not a supported freedom:" + for DRIVER in "${FREEDOMS[@]}"; do + echo "${FREEDOM}" + done + exit 1 + fi + else + FREEDOM="standard" + fi + VM_PATH="${OS}-${RELEASE}-${FREEDOM}" + get_debian "${FREEDOM}" elif [ "${OS}" == "elementary" ]; then get_elementary elif [ "${OS}" == "macos" ]; then @@ -1395,6 +1699,8 @@ if [ -n "${2}" ]; then get_openbsd elif [ "${OS}" == "opensuse" ]; then get_opensuse + elif [ "${OS}" == "oraclelinux" ]; then + get_oraclelinux elif [ "${OS}" == "popos" ]; then if [ -n "${3}" ]; then DRIVER="${3}" @@ -1456,10 +1762,14 @@ if [ -n "${2}" ]; then fi else echo -n "ERROR! You must specify a release: " - if [ "${OS}" == "android" ]; then + if [ "${OS}" == "alma" ]; then + releases_alma + elif [ "${OS}" == "android" ]; then releases_android elif [ "${OS}" == "archlinux" ]; then releases_archlinux + elif [ "${OS}" == "debian" ]; then + releases_debian elif [ "${OS}" == "elementary" ]; then releases_elementary elif [ "${OS}" == "freebsd" ]; then @@ -1478,6 +1788,8 @@ else releases_nixos elif [ "${OS}" == "opensuse" ]; then releases_opensuse + elif [ "${OS}" == "oraclelinux" ]; then + releases_oraclelinux elif [ "${OS}" == "openbsd" ]; then releases_openbsd elif [ "${OS}" == "macos" ]; then @@ -1486,6 +1798,8 @@ else releases_popos elif [ "${OS}" == "regolith" ]; then releases_regolith + elif [ "${OS}" == "rockylinux" ]; then + releases_rockylinux elif [ "${OS}" == "solus" ]; then releases_solus elif [[ "${OS}" == *"ubuntu"* ]]; then