From 373f133ac716e7e0ccb54a61540bd08be2669b5c Mon Sep 17 00:00:00 2001 From: Phil Clifford Date: Mon, 30 Dec 2024 10:58:18 +0000 Subject: [PATCH] fix(easyos): move to dynamic release behaviour (#1494) The static list included a release that has been removed and also hard coded mappings for 2023 and 2024. This dynamically determines the latest two years and finds available releases in those years, so will still provide reasonable service next year. --- quickget | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/quickget b/quickget index acc4a79d4f..9888fa9fa1 100755 --- a/quickget +++ b/quickget @@ -679,16 +679,17 @@ function releases_dragonflybsd() { } function releases_easyos() { - #local Y2023="" - #local Y2024="" - #Y2024=$(web_pipe https://distro.ibiblio.org/easyos/amd64/releases/kirkstone/2024/ | grep "tr class" | tail -n +2 | cut -d'"' -f6 | cut -d'/' -f1 | sort -r) - #Y2023=$(web_pipe https://distro.ibiblio.org/easyos/amd64/releases/kirkstone/2023/ | grep "tr class" | tail -n +2 | cut -d'"' -f6 | cut -d'/' -f1 | sort -r) - #echo -n ${2024} - #echo ${Y2023} - # Not dynamic for now - echo 5.7 5.6.7 5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 + local ALL_RELEASES="" + local YEAR="" + # get the latest 2 years of releases so that when we hit next year we still have the latest 2 years + TWO_YEARS=$(web_pipe https://distro.ibiblio.org/easyos/amd64/releases/kirkstone/ | grep -o -E '[[:digit:]]{4}/' | sort -nr | tr -d / | head -n 2 ) + for YEAR in ${TWO_YEARS} ; do + ALL_RELEASES="${ALL_RELEASES} $(web_pipe https://distro.ibiblio.org/easyos/amd64/releases/kirkstone/${YEAR}/ | grep -o -E '[[:digit:]]+(\.[[:digit:]])+/' | tr -d / | sort -nr)" + done + echo ${ALL_RELEASES} } + function releases_elementary() { echo 8.0 7.1 7.0 } @@ -1766,12 +1767,14 @@ function get_easyos() { local ISO="" local YEAR="" ISO="easy-${RELEASE}-amd64.img" - case ${RELEASE} in - 5.6.5|5.6.4|5.6.3|5.6.2|5.6.1) YEAR="2023";; - 5.7|5.6.7|5.6.6) YEAR="2024";; - esac - URL="https://distro.ibiblio.org/easyos/amd64/releases/kirkstone/${YEAR}/${RELEASE}" - HASH=$(web_pipe "${URL}/md5.sum.txt" | cut -d' ' -f1) + TWO_YEARS=$(web_pipe https://distro.ibiblio.org/easyos/amd64/releases/kirkstone/ | grep -o -E '[[:digit:]]{4}/' | sort -nr | tr -d / | head -n 2 ) + for YEAR in ${TWO_YEARS} ; do + if web_check "https://distro.ibiblio.org/easyos/amd64/releases/kirkstone/${YEAR}/${RELEASE}/" ; then + URL="https://distro.ibiblio.org/easyos/amd64/releases/kirkstone/${YEAR}/${RELEASE}" + HASH=$(web_pipe "${URL}/md5.sum.txt" | cut -d' ' -f1) + break + fi + done echo "${URL}/${ISO} ${HASH}" }