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.
This commit is contained in:
Phil Clifford 2024-12-30 10:58:18 +00:00 committed by GitHub
parent a305f993c3
commit 373f133ac7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 14 deletions

View File

@ -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}"
}