diff --git a/.github/screenshot.png b/.github/screenshot.png deleted file mode 100644 index 618340defc..0000000000 Binary files a/.github/screenshot.png and /dev/null differ diff --git a/README.md b/README.md index 33bc86cbe8..f8c52e93b1 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,14 @@ **Quickly create and run optimised Windows, macOS and Linux virtual machines:** -Quickemu Screenshot - **Made with 💝 for Tux (Linux)** - -We have a Discord for this project: - -[![Discord](https://img.shields.io/discord/712850672223125565?color=0C306A&label=WimpysWorld%20Discord&logo=Discord&logoColor=ffffff&style=flat-square)](https://discord.gg/sNmz3uw) +

+  Discord  +  Mastodon  +  Twitter  +  LinkedIn  +

# Introduction @@ -85,6 +85,10 @@ quickemu --vm nixos-unstable.conf - Execute `quickget` (with no arguments) to see a list of all the supported operating systems. +## Demo + +
+ # Documentation The wiki describes how to get up and running with Quickemu and also @@ -129,6 +133,7 @@ We welcome contributions to Quickemu. - Submit [Quickemu Pull requests](https://github.com/quickemu-project/quickemu/pulls) to fix bugs 🐞 or add new features ✨ + - Follow our [guide to adding a new OS to quickget](https://github.com/quickemu-project/quickemu/wiki/06-Advanced-quickget-features#adding-a-new-os-to-quickget) - Commit messages must [conform to the Conventional Commits - specification](https://www.conventionalcommits.org/). + specification](https://www.conventionalcommits.org/) - [Sponsor the project](https://github.com/sponsors/flexiondotorg) 💖 diff --git a/quickemu b/quickemu index c0efb8a5b2..8812ca91ad 100755 --- a/quickemu +++ b/quickemu @@ -237,6 +237,7 @@ function vm_boot() { local OSK="" local SOUND="" local SMM="${SMM:-off}" + local TEMP_PORT="" local USB_HOST_PASSTHROUGH_CONTROLLER="qemu-xhci" local VGA="" local VIDEO="" @@ -400,6 +401,7 @@ function vm_boot() { if [ -n "${EFI_CODE}" ] || [ ! -e "${EFI_CODE}" ]; then case ${secureboot} in on) + # shellcheck disable=SC2054,SC2140 ovmfs=("/usr/share/OVMF/OVMF_CODE_4M.secboot.fd","/usr/share/OVMF/OVMF_VARS_4M.fd" \ "/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd","/usr/share/edk2/ovmf/OVMF_VARS.fd" \ "/usr/share/OVMF/x64/OVMF_CODE.secboot.fd","/usr/share/OVMF/x64/OVMF_VARS.fd" \ @@ -410,6 +412,7 @@ function vm_boot() { ) ;; *) + # shellcheck disable=SC2054,SC2140 ovmfs=("/usr/share/OVMF/OVMF_CODE_4M.fd","/usr/share/OVMF/OVMF_VARS_4M.fd" \ "/usr/share/edk2/ovmf/OVMF_CODE.fd","/usr/share/edk2/ovmf/OVMF_VARS.fd" \ "/usr/share/OVMF/OVMF_CODE.fd","/usr/share/OVMF/OVMF_VARS.fd" \ @@ -443,7 +446,7 @@ function vm_boot() { echo " Please install OVMF firmware." exit 1 fi - if [ ! -z "${EFI_EXTRA_VARS}" ]; then + if [ -n "${EFI_EXTRA_VARS}" ]; then if [ ! -e "${EFI_EXTRA_VARS}" ]; then echo " - EFI: ERROR! EFI_EXTRA_VARS file ${EFI_EXTRA_VARS} does not exist." exit 1 @@ -992,7 +995,8 @@ function vm_boot() { # Only enable SPICE is using SPICE display if [ "${OUTPUT}" == "none" ] || [ "${OUTPUT}" == "spice" ] || [ "${OUTPUT}" == "spice-app" ]; then - args+=(-spice ${SPICE} + # shellcheck disable=SC2054 + args+=(-spice "${SPICE}" -device virtio-serial-pci -chardev socket,id=agent0,path="${VMDIR}/${VMNAME}-agent.sock",server=on,wait=off -device virtserialport,chardev=agent0,name=org.qemu.guest_agent.0 @@ -1002,9 +1006,10 @@ function vm_boot() { -device virtserialport,chardev=webdav0,name=org.spice-space.webdav.0) fi + # shellcheck disable=SC2054 args+=(-device virtio-rng-pci,rng=rng0 -object rng-random,id=rng0,filename=/dev/urandom - -device ${USB_HOST_PASSTHROUGH_CONTROLLER},id=spicepass + -device "${USB_HOST_PASSTHROUGH_CONTROLLER}",id=spicepass -chardev spicevmc,id=usbredirchardev1,name=usbredir -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 -chardev spicevmc,id=usbredirchardev2,name=usbredir @@ -1016,6 +1021,7 @@ function vm_boot() { ) if "${QEMU}" -chardev spicevmc,id=ccid,name= 2>&1 | grep -q smartcard; then + # shellcheck disable=SC2054 args+=(-chardev spicevmc,id=ccid,name=smartcard -device ccid-card-passthru,chardev=ccid) else @@ -1025,8 +1031,10 @@ function vm_boot() { # setup usb-controller [ -z "${USB_CONTROLLER}" ] && USB_CONTROLLER="$usb_controller" if [ "${USB_CONTROLLER}" == "ehci" ]; then + # shellcheck disable=SC2054 args+=(-device usb-ehci,id=input) elif [ "${USB_CONTROLLER}" == "xhci" ]; then + # shellcheck disable=SC2054 args+=(-device qemu-xhci,id=input) elif [ -z "${USB_CONTROLLER}" ] || [ "${USB_CONTROLLER}" == "none" ]; then # add nothing @@ -1039,8 +1047,10 @@ function vm_boot() { # @INFO: must be set after usb-controller [ -z "${KEYBOARD}" ] && KEYBOARD="$keyboard" if [ "${KEYBOARD}" == "usb" ]; then + # shellcheck disable=SC2054 args+=(-device usb-kbd,bus=input.0) elif [ "${KEYBOARD}" == "virtio" ]; then + # shellcheck disable=SC2054 args+=(-device virtio-keyboard) elif [ "${KEYBOARD}" == "ps2" ] || [ -z "${KEYBOARD}" ]; then # add nothing, default is ps/2 keyboard @@ -1053,7 +1063,7 @@ function vm_boot() { # @INFO: When using the VNC display, you must use the -k parameter to set the keyboard layout if you are not using en-us. [ -z "${KEYBOARD_LAYOUT}" ] && KEYBOARD_LAYOUT="$keyboard_layout" if [ -n "${KEYBOARD_LAYOUT}" ]; then - args+=(-k ${KEYBOARD_LAYOUT}) + args+=(-k "${KEYBOARD_LAYOUT}") fi # FIXME: Check for device availability. qemu will fail to start otherwise @@ -1067,10 +1077,13 @@ function vm_boot() { # @INFO: must be set after usb-controller [ -z "${MOUSE}" ] && MOUSE="$mouse" if [ "${MOUSE}" == "usb" ]; then + # shellcheck disable=SC2054 args+=(-device usb-mouse,bus=input.0) elif [ "${MOUSE}" == "tablet" ]; then + # shellcheck disable=SC2054 args+=(-device usb-tablet,bus=input.0) elif [ "${MOUSE}" == "virtio" ]; then + # shellcheck disable=SC2054 args+=(-device virtio-mouse) elif [ "${MOUSE}" == "ps2" ] || [ -z "${MOUSE}" ]; then # add nothing, default is ps/2 mouse @@ -1189,6 +1202,7 @@ function vm_boot() { args+=(-drive if=ide,index=0,media=disk,file="${disk_img}") elif [ "${guest_os}" == "windows-server" ]; then + # shellcheck disable=SC2054,SC2206 args+=(-device ide-hd,drive=SystemDisk -drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO}) @@ -1239,16 +1253,18 @@ function vm_boot() { echo " - Monitor: (off)" elif [ "${MONITOR}" == "telnet" ]; then # Find a free port to expose monitor-telnet to the guest - local temp_port="$(get_port ${MONITOR_TELNET_PORT} 9)" - if [ -z "${temp_port}" ]; then + TEMP_PORT="$(get_port ${MONITOR_TELNET_PORT} 9)" + if [ -z "${TEMP_PORT}" ]; then echo " - Monitor: All Monitor-Telnet ports have been exhausted." else - MONITOR_TELNET_PORT="${temp_port}" - args+=(-monitor telnet:${MONITOR_TELNET_HOST}:${MONITOR_TELNET_PORT},server,nowait) + MONITOR_TELNET_PORT="${TEMP_PORT}" + # shellcheck disable=SC2054 + args+=(-monitor telnet:"${MONITOR_TELNET_HOST}:${MONITOR_TELNET_PORT}",server,nowait) echo " - Monitor: On host: telnet ${MONITOR_TELNET_HOST} ${MONITOR_TELNET_PORT}" echo "monitor-telnet,${MONITOR_TELNET_PORT},${MONITOR_TELNET_HOST}" >> "${VMDIR}/${VMNAME}.ports" fi elif [ "${MONITOR}" == "socket" ]; then + # shellcheck disable=SC2054,SC2206 args+=(-monitor unix:${VM_MONITOR_SOCKETPATH},server,nowait) echo " - Monitor: On host: nc -U \"${VM_MONITOR_SOCKETPATH}\"" echo " or : socat -,echo=0,icanon=0 unix-connect:${VM_MONITOR_SOCKETPATH}" @@ -1276,16 +1292,18 @@ function vm_boot() { args+=(-serial none) elif [ "${SERIAL}" == "telnet" ]; then # Find a free port to expose serial-telnet to the guest - local temp_port="$(get_port ${SERIAL_TELNET_PORT} 9)" - if [ -z "${temp_port}" ]; then + TEMP_PORT="$(get_port ${SERIAL_TELNET_PORT} 9)" + if [ -z "${TEMP_PORT}" ]; then echo " - Serial: All Serial-Telnet ports have been exhausted." else - SERIAL_TELNET_PORT="${temp_port}" + SERIAL_TELNET_PORT="${TEMP_PORT}" + # shellcheck disable=SC2054,SC2206 args+=(-serial telnet:${SERIAL_TELNET_HOST}:${SERIAL_TELNET_PORT},server,nowait) echo " - Serial: On host: telnet ${SERIAL_TELNET_HOST} ${SERIAL_TELNET_PORT}" echo "serial-telnet,${SERIAL_TELNET_PORT},${SERIAL_TELNET_HOST}" >> "${VMDIR}/${VMNAME}.ports" fi elif [ "${SERIAL}" == "socket" ]; then + # shellcheck disable=SC2054,SC2206 args+=(-serial unix:${VM_SERIAL_SOCKETPATH},server,nowait) echo " - Serial: On host: nc -U \"${VM_SERIAL_SOCKETPATH}\"" echo " or : socat -,echo=0,icanon=0 unix-connect:${VM_SERIAL_SOCKETPATH}" @@ -1298,6 +1316,7 @@ function vm_boot() { EXTRA_ARGS="${extra_args}" fi if [ -n "${EXTRA_ARGS}" ]; then + # shellcheck disable=SC2206 args+=(${EXTRA_ARGS}) fi @@ -1468,9 +1487,12 @@ function parse_ports_from_file { local FILE="${VMDIR}/${VMNAME}.ports" # parse ports - local port_name=( $(cat "$FILE" | cut -d, -f1) ) - local port_number=( $(cat "$FILE" | cut -d, -f2) ) - local host_name=( $(cat "$FILE" | gawk 'FS="," {print $3,"."}') ) + # shellcheck disable=SC2207 + local port_name=( $(cat "${FILE}" | cut -d',' -f 1) ) + # shellcheck disable=SC2207 + local port_number=( $(cat "${FILE}" | cut -d',' -f 2) ) + # shellcheck disable=SC2207 + local host_name=( $(cat "${FILE}" | gawk 'FS="," {print $3,"."}') ) for ((i=0; i<${#port_name[@]}; i++)); do if [ "${port_name[$i]}" == "ssh" ]; then @@ -1562,7 +1584,6 @@ public_dir="" monitor="socket" monitor_telnet_port="4440" monitor_telnet_host="localhost" -monitor_cmd="" serial="socket" serial_telnet_port="6660" serial_telnet_host="localhost" @@ -1675,7 +1696,7 @@ else shift shift;; -screenpct|--screenpct) - if [ ! -z "${2##*[!0-9]*}" ] ; then + if [ -n "${2##*[!0-9]*}" ] ; then if [[ ${2} -ge 25 && ${2} -lt 100 ]] ; then SCREENPCT=${2} else @@ -1924,7 +1945,7 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then VM_UP=0 if [ -r "${VMDIR}/${VMNAME}.pid" ]; then VM_PID=$(head -c50 "${VMDIR}/${VMNAME}.pid") - kill -0 ${VM_PID} 2>&1 >/dev/null + kill -0 ${VM_PID} > /dev/null 2>&1 if [ $? -eq 0 ]; then echo "VM already started!" VM_UP=1 diff --git a/quickget b/quickget index 01afcbaaf8..a41102fef3 100755 --- a/quickget +++ b/quickget @@ -1,28 +1,10 @@ #!/usr/bin/env bash +# SC2317: Command appears to be unreachable. Check usage (or ignore if invoked indirectly). +# - https://www.shellcheck.net/wiki/SC2317 +# - Disable globally because many functions are called indirectly +# shellcheck disable=SC2317 export LC_ALL=C -# Here the quick 'n dirty guide to adding a new OS to quickget -# -# 1. Update os_support() - add new OS, all lowercase -# 2. Update os_info() - Fill all posible fields for new OS (leave empty if no login, but | must stay same) -# Here is whats should be there... -# ) INFO="||||";; -# 4. Create a releases_newos() generator (required) outputs the current supported release versions (from newest) -# 5. Create a editions_newos() generator (optional) outputs the editions if new OS has multiple flavours/editions -# 6. Update make_vm_config() - add any *required* new OS tweaks -# 7. Create a get_newos() function - that does something like this: (Look at other OS) -# For cutting first field with hash you can use function `cut_1` instead of `cut -d' ' -f1`` -# -#function get_newos() { -# local EDITION="${1:-}" -# local HASH="" -# local ISO="newos-${RELEASE}-${EDITION}-amd64.iso" -# local URL="https://www.newos.org/download/${RELEASE}/${EDITION}" -# -# HASH=$(web_pipe "${URL}/SHA512SUMS" | grep "${ISO}" | cut_1) -# echo "${URL}/${ISO} ${HASH}" -#} - function cleanup() { if [ -n "$(jobs -p)" ]; then kill "$(jobs -p)" 2>/dev/null @@ -40,7 +22,7 @@ function os_info() { SIMPLE_NAME="${1}" case ${SIMPLE_NAME} in #name) INFO="PrettyName|BasedOf|Credentials|Homepage|Info";; - alma) INFO="Alma Linux|Fedora,RedHat|-|https://almalinux.org/|Community owned and governed, forever-free enterprise Linux distribution, focused on long-term stability, providing a robust production-grade platform. AlmaLinux OS is binary compatible with RHEL®.";; + alma) INFO="AlmaLinux|Fedora,RedHat|-|https://almalinux.org/|Community owned and governed, forever-free enterprise Linux distribution, focused on long-term stability, providing a robust production-grade platform. AlmaLinux OS is binary compatible with RHEL®.";; alpine) INFO="Alpine Linux|Independent|-|https://alpinelinux.org/|Security-oriented, lightweight Linux distribution based on musl libc and busybox.";; android) INFO="Android x86|Independent|-|https://www.android-x86.org/|Port Android Open Source Project to x86 platform.";; antix) INFO="Antix|Debian|-|https://antixlinux.com/|Fast, lightweight and easy to install systemd-free linux live CD distribution based on Debian Stable for Intel-AMD x86 compatible systems.";; @@ -58,7 +40,7 @@ function os_info() { cachyos) INFO="CachyOS|Arch|-|https://cachyos.org/|Designed to deliver lightning-fast speeds and stability, ensuring a smooth and enjoyable computing experience every time you use it.";; centos-stream) INFO="CentOS Stream|Fedora,RedHat|-|https://www.centos.org/centos-stream/|Continuously delivered distro that tracks just ahead of Red Hat Enterprise Linux (RHEL) development, positioned as a midstream between Fedora Linux and RHEL.";; chimeralinux) INFO="Chimera Linux|Independent|anon:chimera root:chimera|https://chimera-linux.org/|Modern, general-purpose non-GNU Linux distribution.";; - crunchbang++) INFO="#!++|Debian|-|https://www.crunchbangplusplus.org/|The classic minimal crunchbang feel, now with debian 12 bookworm.";; + crunchbang++) INFO="Crunchbangplusplus|Debian|-|https://www.crunchbangplusplus.org/|The classic minimal crunchbang feel, now with debian 12 bookworm.";; debian) INFO="Debian|Independent|-|https://www.debian.org/|Complete Free Operating System with perfect level of ease of use and stability.";; deepin) INFO="Deepin|Debian|-|https://www.deepin.org/|Beautiful UI design, intimate human-computer interaction, and friendly community environment make you feel at home.";; devuan) INFO="Devuan|Debian|-|https://www.devuan.org/|Fork of Debian without systemd that allows users to reclaim control over their system by avoiding unnecessary entanglements and ensuring Init Freedom.";; @@ -77,7 +59,7 @@ function os_info() { gnomeos) INFO="GNOME OS|Independent|-|https://os.gnome.org/|Alpha nightly bleeding edge distro of GNOME";; guix) INFO="Guix|Independent|-|https://guix.gnu.org/|Distribution of the GNU operating system developed by the GNU Project—which respects the freedom of computer users.";; haiku) INFO="Haiku|Independent|-|https://www.haiku-os.org/|Specifically targets personal computing. Inspired by the BeOS, Haiku is fast, simple to use, easy to learn and yet very powerful.";; - holoiso) INFO="SteamOS HoloISO|Arch,SteamOS|-|https://github.com/HoloISO/holoiso|Bring the Steam Decks SteamOS Holo redistribution and provide a close-to-official SteamOS experience.";; + holoiso) INFO="HoloISO|Arch,SteamOS|-|https://github.com/HoloISO/holoiso|Bring the Steam Decks SteamOS Holo redistribution and provide a close-to-official SteamOS experience.";; kali) INFO="Kali|Debian|-|https://www.kali.org/|The most advanced Penetration Testing Distribution.";; kdeneon) INFO="KDE Neon|Debian,Ubuntu|-|https://neon.kde.org/|Latest and greatest of KDE community software packaged on a rock-solid base.";; kolibrios) INFO="KolibriOS|Independent|-|http://kolibrios.org/en/|Tiny yet incredibly powerful and fast operating system.";; @@ -133,7 +115,6 @@ function os_info() { vanillaos) INFO="Vanilla OS|Debian,Ubuntu|-|https://vanillaos.org/|Designed to be a reliable and productive operating system for your daily work.";; void) INFO="Void Linux|Independent|anon:voidlinux|https://voidlinux.org/|General purpose operating system. Its package system allows you to quickly install, update and remove software; software is provided in binary packages or can be built directly from sources.";; vxlinux) INFO="VX Linux|Void|-|https://vxlinux.org/|Pre-configured, secure systemd-free Plasma desktop with focus on convenience, performance and simplicity. Based on the excellent Void Linux.";; - whonix) INFO="Whonix|Debian|-|https://www.whonix.org/|Superior Internet Privacy with Whonix™ As handy as an app - delivering maximum anonymity and security.";; windows) INFO="Windows|proprietary|-|https://www.microsoft.com/en-us/windows/|Whether you’re gaming, studying, running a business, or running a household, Windows helps you get it done.";; windows-server) INFO="Windows Server|proprietary|-|https://www.microsoft.com/en-us/windows-server/|Platform for building an infrastructure of connected applications, networks, and web services.";; xubuntu) INFO="Xubuntu|Ubuntu|-|https://xubuntu.org/|Elegant and easy to use operating system. Xubuntu comes with Xfce, which is a stable, light and configurable desktop environment.";; @@ -145,7 +126,7 @@ function os_info() { function show_os_info() { while getopts ":12345" opt; do case $opt in - 1|2|3|4|5) os_info "${2}" | cut -d'|' -f${opt};; + 1|2|3|4|5) os_info "${2}" | cut -d'|' -f "${opt}";; *) error_not_supported_argument;; esac done @@ -161,21 +142,23 @@ function os_homepage() { } function error_specify_os() { - echo 'ERROR! You must specify an operating system.' - echo '- Supported Operating Systems:' + echo "ERROR! You must specify an operating system." + echo "- Supported Operating Systems:" os_support | fold -s -w "$(tput cols)" echo -e "\nTo see all possible arguments, use:\n quickget -h or quickget --help" exit 1 } function os_supported() { - if [[ ! " $(os_support) " =~ " ${OS} " ]]; then - error_not_supported_os + if [[ ! "$(os_support)" =~ ${OS} ]]; then + echo -e "ERROR! ${OS} is not a supported OS.\n" + os_support | fold -s -w "$(tput cols)" + exit 1 fi } function error_specify_release() { - echo 'ERROR! You must specify a release.' + echo "ERROR! You must specify a release." case ${OS} in *ubuntu-server*) echo -n ' - Releases: ' @@ -212,30 +195,24 @@ function error_specify_edition() { #TODO: Not yet used! function error_specify_path() { - echo 'ERROR! You must specify path.' + echo "ERROR! You must specify path." error_specify_os exit 1 } -function error_not_supported_os() { - echo -e "ERROR! ${OS} is not a supported OS.\n" - os_support | fold -s -w "$(tput cols)" - exit 1 -} - function error_not_supported_release() { - if [[ ! " ${RELEASES[*]} " =~ " ${RELEASE} " ]]; then - echo -e "ERROR! ${DISPLAY_NAME} ${RELEASE} is not a supported release." - echo -n 'Supported releases: ' + if [[ ! "${RELEASES[*]}" =~ ${RELEASE} ]]; then + echo -e "ERROR! ${DISPLAY_NAME} ${RELEASE} is not a supported release.\n" + echo -n ' - Supported releases: ' "releases_${OS}" exit 1 fi } function error_not_supported_edition() { - if [[ ! " ${EDITIONS[*]} " =~ " ${EDITION} " ]]; then + if [[ ! "${EDITIONS[*]}" =~ ${EDITION} ]]; then echo -e "ERROR! ${EDITION} is not a supported $(pretty_name "${OS}") edition\n" - echo -n ' - Editions: ' + echo -n ' - Supported editions: ' for EDITION in "${EDITIONS[@]}"; do echo -n "${EDITION} " done @@ -452,7 +429,7 @@ function test_all() { if [ "${OPERATION}" == "show" ]; then test_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}" elif [ "${OPERATION}" == "test" ]; then - CHECK=$(web_check "${URL}" && echo 'PASS' || echo 'FAIL') + CHECK=$(web_check "${URL}" && echo "PASS" || echo "FAIL") test_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}" "${CHECK}" fi done @@ -481,7 +458,7 @@ function test_all() { if [ "${OPERATION}" == "show" ]; then test_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}" elif [ "${OPERATION}" == "test" ]; then - CHECK=$(web_check "${URL}" && echo 'PASS' || echo 'FAIL') + CHECK=$(web_check "${URL}" && echo "PASS" || echo "FAIL") test_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}" "${CHECK}" fi fi @@ -733,6 +710,7 @@ function releases_debian() { local OLD="" NEW=$(web_pipe "https://cdimage.debian.org/debian-cd/" | grep '\.[0-9]/' | cut -d'>' -f 9 | cut -d'/' -f 1) OLD=$(web_pipe "https://cdimage.debian.org/cdimage/archive/" | grep -e '>[1-9][0-9]\.' | grep -v 'live' | grep -v NEVER | cut -d'>' -f 9 | cut -d'/' -f 1 | tac | head -20) + #shellcheck disable=SC2086 echo ${NEW} ${OLD} } @@ -1133,8 +1111,10 @@ function releases_ubuntu() { local SUPPORTED_VERSIONS=() local EOL_VERSIONS=() VERSION_DATA="$(IFS=$'\n' web_pipe https://api.launchpad.net/devel/ubuntu/series | jq -r '.entries[]')" - SUPPORTED_VERSIONS=($(IFS=$'\n' jq -r 'select(.status=="Supported" or .status=="Current Stable Release") | .version' <<<${VERSION_DATA} | sort)) - EOL_VERSIONS=($(IFS=$'\n' jq -r 'select(.status=="Obsolete") | .version' <<<${VERSION_DATA} | sort)) + # shellcheck disable=SC2207 + SUPPORTED_VERSIONS=($(IFS=$'\n' jq -r 'select(.status=="Supported" or .status=="Current Stable Release") | .version' <<<"${VERSION_DATA}" | sort)) + # shellcheck disable=SC2207 + EOL_VERSIONS=($(IFS=$'\n' jq -r 'select(.status=="Obsolete") | .version' <<<"${VERSION_DATA}" | sort)) case "${OS}" in ubuntu) echo "${SUPPORTED_VERSIONS[@]}" daily-live "${EOL_VERSIONS[@]/#/eol-}";; @@ -1151,8 +1131,10 @@ function releases_ubuntu() { } function releases_ubuntu-server() { - local ALL_VERSIONS=($(IFS=$'\n' web_pipe http://releases.ubuntu.com/streams/v1/com.ubuntu.releases:ubuntu-server.json | jq -r '.products[] | select(.arch=="amd64") | .version' | sort -rV)) - echo "${ALL_VERSIONS[@]}" + local ALL_VERSIONS=() + # shellcheck disable=SC2207 + ALL_VERSIONS=($(IFS=$'\n' web_pipe http://releases.ubuntu.com/streams/v1/com.ubuntu.releases:ubuntu-server.json | jq -r '.products[] | select(.arch=="amd64") | .version' | sort -rV)) + echo daily-live "${ALL_VERSIONS[@]}" } function releases_vanillaos() { @@ -1278,7 +1260,7 @@ function web_get() { test_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}" exit 0 elif [ "${OPERATION}" == "test" ]; then - CHECK=$(web_check "${URL}" && echo 'PASS' || echo 'FAIL') + CHECK=$(web_check "${URL}" && echo "PASS" || echo "FAIL") test_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}" "${CHECK}" exit 0 elif [ "${OPERATION}" == "download" ]; then @@ -1342,7 +1324,7 @@ function zsync_get() { test_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}" exit 0 elif [ "${OPERATION}" == "test" ]; then - CHECK=$(web_check "${URL}" && echo 'PASS' || echo 'FAIL') + CHECK=$(web_check "${URL}" && echo "PASS" || echo "FAIL") test_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}" "${CHECK}" exit 0 elif command -v zsync &>/dev/null; then @@ -1552,7 +1534,7 @@ EOF fi fi echo -e "\nTo start your $(pretty_name "${OS}") virtual machine run:" - if [ ${OS} == "slint" ]; then + if [ "${OS}" == "slint" ]; then echo -e " quickemu --vm ${CONF_FILE}\nTo start Slint with braille support run:\n quickemu --vm --braille --display sdl ${CONF_FILE}" else echo " quickemu --vm ${CONF_FILE}" @@ -1880,6 +1862,7 @@ function get_fedora() { Server|Kinoite|Onyx|Silverblue|Sericea|Workstation) VARIANT="${EDITION}";; *) VARIANT="Spins";; esac + #shellcheck disable=SC2086 JSON=$(web_pipe "https://getfedora.org/releases.json" | jq '.[] | select(.variant=="'${VARIANT}'" and .subvariant=="'"${EDITION}"'" and .arch=="x86_64" and .version=="'"${RELEASE}"'")') URL=$(echo "${JSON}" | jq -r '.link' | head -n1) HASH=$(echo "${JSON}" | jq -r '.sha256' | head -n1) @@ -2034,7 +2017,7 @@ function generate_id() { local macRecoveryID="" local TYPE="${1}" local valid_chars=("0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F") - for ((i=0; i<$TYPE; i++)); do + for ((i=0; i [path] [re] [ed] + quickget [path] [release] [edition] quickget --download ubuntu 22.04 Arguments: - -[12345] : Show info* about OS - --download (-d) [ed] : Download image; no VM configuration - --create-config (-cc) [path/url]: Create default VM config for image - --open-homepage (-o) : Open homepage for the OS - --version (-v) : Show version - --help (-h) : Show this help message + -[12345] : Show info* about OS + --download [edition] : Download image; no VM configuration + --create-config [path/url] : Create VM config for a OS image + --open-homepage : Open homepage for the OS + --version : Show version + --help : Show this help message -------------------------- For testing & development --------------------------- - --url (-u) [os] [re] [ed] : Show image URL(s) - --check (-c) [os] [re] [ed] : Check image URL(s) - --list (-l) : List all supported systems - --list-csv (-lc) : List everything in csv format - --list-json (-lj) : List everything in json format + --url [os] [release] [edition] : Show image URL(s) + --check [os] [release] [edition] : Check image URL(s) + --list : List all supported systems + --list-csv : List everything in csv format + --list-json : List everything in json format -------------------------------------------------------------------------------- *info: 1=Logo 2=Based of 3=Credentials 4=Homepage 5=Short info Can be used in any combination like -13254 or -52 @@ -3479,34 +3472,35 @@ if [ ! -e "${CURL}" ]; then fi CURL_VERSION=$("${CURL}" --version | head -1 | cut -d' ' -f2) +#TODO: Deprecate `list`, `list_csv`, and `list_json` in favor of `--list`, `--list-csv`, and `--list-json` case "${1}" in -1*|-2*|-3*|-4*|-5*) show_os_info "${1}" "${2}" exit 0 ;; - '--download'|'-d') + --download|-download) OPERATION="download" shift ;; - '--create-config'|'-cc') + --create-config|-create-config) OPERATION="config" shift create_config "${@}" ;; - '--open-homepage'|'-o') + --open-homepage|-open-homepage) shift open_homepage "${1}" ;; - '--version'|'-v') + --version|-version) WHERE=$(dirname "${BASH_SOURCE[0]}") "${WHERE}/quickemu" --version exit 0 ;; - '--help'|'-h') + --help|-help|--h|-h) help_message exit 0 ;; - '--url'|'-u') + --url|-url) OPERATION="show" shift if [ -z "${1}" ]; then @@ -3519,29 +3513,22 @@ case "${1}" in exit 0 fi ;; - '--check'|'-c') + --check|-check) OPERATION="test" shift if [ -z "${1}" ]; then for OS in $(os_support); do (test_all "${OS}") done + exit 0 elif [ -z "${2}" ]; then test_all "${1}" + exit 0 fi - exit 0 - ;; - #TODO: Argument without dashes should be DEPRECATED! - '--list-csv'|'-lc'|'list'|'list_csv'|'lc') - list_csv - ;; - #TODO: Argument without dashes should be DEPRECATED! - '--list-json'|'-lj'|'list_json') - list_json - ;; - '--list'|'-l') - list_supported ;; + --list-csv|-list-csv|list|list_csv) list_csv;; + --list-json|-list-json|list_json) list_json;; + --list|-list) list_supported;; -*) error_not_supported_argument ;; @@ -3561,7 +3548,8 @@ if [ -n "${2}" ]; then # If the OS has an editions_() function, use it. if [[ $(type -t "editions_${OS}") == function ]]; then validate_release "releases_${OS}" - EDITIONS=($(editions_${OS})) + EDITIONS=("$(editions_${OS})") + # Default to the first edition if none is specified. EDITION=${EDITIONS[0]} if [ -n "${3}" ]; then EDITION="${3}" @@ -3590,7 +3578,7 @@ if [ -n "${2}" ]; then "languages_${OS}" if [ -n "${3}" ]; then LANG="${3}" - if [[ ! ${LANGS[*]} =~ "${LANG}" ]]; then + if [[ ! "${LANGS[*]}" =~ ${LANG} ]]; then error_not_supported_lang fi VM_PATH="$(echo "${OS}-${RELEASE}-${LANG// /-}" | tr -d '()')"