From 16a43af3290a42ed4569ac984ffa0d86289e964c Mon Sep 17 00:00:00 2001 From: Phil Clifford Date: Tue, 29 Oct 2024 12:01:33 +0000 Subject: [PATCH] fix(fedora): handle the space in the beta release (#1492) * fix(fedora): handle the space in the beta release fixes #1462 adjust the RELEASE to remove and replace the space * fix(fedora): only list available editions where a release is selected fixes #1493 --- quickget | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/quickget b/quickget index ffb12ff7b2..07d2238960 100755 --- a/quickget +++ b/quickget @@ -211,7 +211,13 @@ function handle_missing() { # Handle odd missing Fedora combinations case "${OS}" in fedora) - if [[ "${RELEASE}" -lt 40 && "${EDITION}" == "Onyx" ]] || [[ "${RELEASE}" -lt 40 && "${EDITION}" == "Sericea" ]]; then + # First we need to handle the Beta naming kludge + if [[ "${RELEASE}" == *"_Beta" ]]; then + NRELEASE="${RELEASE/_Beta/}" + else + NRELEASE="${RELEASE}" + fi + if [[ "${NRELEASE}" -lt 40 && "${EDITION}" == "Onyx" ]] || [[ "${NRELEASE}" -lt 40 && "${EDITION}" == "Sericea" ]]; then echo "ERROR! Unsupported combination" echo " Fedora ${RELEASE} ${EDITION} is not available, please choose another Release or Edition" exit 1 @@ -699,12 +705,16 @@ function editions_endless() { function releases_fedora() { #shellcheck disable=SC2046,SC2005 - echo $(web_pipe "https://getfedora.org/releases.json" | jq -r 'map(.version) | unique | .[]' | sort -r) + echo $(web_pipe "https://getfedora.org/releases.json" | jq -r 'map(.version) | unique | .[]' | sed 's/ /_/g' | sort -r) } function editions_fedora() { #shellcheck disable=SC2046,SC2005 - echo $(web_pipe "https://getfedora.org/releases.json" | jq -r 'map(select(.arch=="x86_64" and .variant!="Labs" and .variant!="IoT" and .variant!="Container" and .variant!="Cloud" and .variant!="Everything" and .subvariant!="Security" and .subvariant!="Server_KVM" and .subvariant!="SoaS")) | map(.subvariant) | unique | .[]') + if [[ -z ${RELEASE} ]]; then + echo $(web_pipe "https://getfedora.org/releases.json" | jq -r "map(select(.arch==\"x86_64\" and .variant!=\"Labs\" and .variant!=\"IoT\" and .variant!=\"Container\" and .variant!=\"Cloud\" and .variant!=\"Everything\" and .subvariant!=\"Security\" and .subvariant!=\"Server_KVM\" and .subvariant!=\"SoaS\")) | map(.subvariant) | unique | .[]") + else + echo $(web_pipe "https://getfedora.org/releases.json" | jq -r "map(select(.arch==\"x86_64\" and .version==\"${RELEASE/_/ }\" and .variant!=\"Labs\" and .variant!=\"IoT\" and .variant!=\"Container\" and .variant!=\"Cloud\" and .variant!=\"Everything\" and .subvariant!=\"Security\" and .subvariant!=\"Server_KVM\" and .subvariant!=\"SoaS\")) | map(.subvariant) | unique | .[]") + fi } function releases_freebsd() { @@ -1802,7 +1812,17 @@ function get_fedora() { Server|Kinoite|Onyx|Silverblue|Sericea|Workstation) VARIANT="${EDITION}";; *) VARIANT="Spins";; esac + # The naming of 41 Beta with a space is problematic so we replaced it with an underscore + # but we need to convert it back to a space for the URL search in the JSON #shellcheck disable=SC2086 + # if RELEASE contains an underscore, replace it with a space + if [[ "${RELEASE}" == *"_"* ]]; then + RELEASE="${RELEASE/_/ }" + fi + + + + # 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}"'" and .sha256 != null)') URL=$(echo "${JSON}" | jq -r '.link' | head -n1) HASH=$(echo "${JSON}" | jq -r '.sha256' | head -n1)