refactor: simply release_debian() and get_debian(). make sure tests pass

This commit is contained in:
Martin Wimpress 2024-04-28 03:04:15 +01:00 committed by Martin Wimpress
parent ea99b9393c
commit 409523d402
1 changed files with 10 additions and 10 deletions

View File

@ -719,11 +719,12 @@ function releases_crunchbang++() {
} }
function releases_debian() { function releases_debian() {
local DEBOLD local NEW=""
DEBCURRENT=$(web_pipe "https://cdimage.debian.org/debian-cd/" | grep '\.[0-9]/' | cut -d'>' -f 9 | cut -d'/' -f 1) local OLD=""
DEBOLD=$(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) NEW=$(web_pipe "https://cdimage.debian.org/debian-cd/" | grep '\.[0-9]/' | cut -d'>' -f 9 | cut -d'/' -f 1)
echo -n "${DEBCURRENT} " 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)
echo ${DEBOLD} echo -n "${NEW} "
echo ${OLD}
} }
function editions_debian() { function editions_debian() {
@ -1728,18 +1729,17 @@ function get_crunchbang++() {
function get_debian() { function get_debian() {
local HASH="" local HASH=""
local ISO="debian-live-${RELEASE}-amd64-${EDITION}.iso" local ISO="debian-live-${RELEASE}-amd64-${EDITION}.iso"
local URL="" local URL="https://cdimage.debian.org/cdimage/archive/${RELEASE}-live/amd64/iso-hybrid"
DEBCURRENT=$(web_pipe "https://cdimage.debian.org/debian-cd/" |grep '\.[0-9]/'|cut -d\> -f9|cut -d\/ -f1) local DEBCURRENT=$(web_pipe "https://cdimage.debian.org/debian-cd/" | grep '\.[0-9]/' | cut -d'>' -f 9 | cut -d'/' -f 1)
case ${RELEASE} in case "${RELEASE}" in
"${DEBCURRENT}") URL="https://cdimage.debian.org/debian-cd/${RELEASE}-live/amd64/iso-hybrid";; "${DEBCURRENT}") URL="https://cdimage.debian.org/debian-cd/${RELEASE}-live/amd64/iso-hybrid";;
*) URL="https://cdimage.debian.org/cdimage/archive/${RELEASE}-live/amd64/iso-hybrid/";;
esac esac
if [ "${EDITION}" == "netinst" ]; then if [ "${EDITION}" == "netinst" ]; then
URL="${URL/-live/}" URL="${URL/-live/}"
URL="${URL/hybrid/cd}" URL="${URL/hybrid/cd}"
ISO="${ISO/-live/}" ISO="${ISO/-live/}"
fi fi
HASH=$(web_pipe "${URL}/SHA512SUMS" | grep "${ISO}" | cut_1) HASH=$(web_pipe "${URL}/SHA512SUMS" | grep "${ISO}" | cut_1 | head -1)
echo "${URL}/${ISO} ${HASH}" echo "${URL}/${ISO} ${HASH}"
} }