Compare commits

...

21 Commits

Author SHA1 Message Date
Martin Wimpress bf3cc8a5f2
refactor: remove line break clean up from releases_arcolinux() 2024-04-28 14:54:48 +01:00
Martin Wimpress 3d5f817e55
refactor: limit bazzite releases to 5 2024-04-28 14:54:04 +01:00
Martin Wimpress d8125b8ed8
feat: if --check-all is requested with no OS, list URLs for all supported OS 2024-04-28 14:43:58 +01:00
Martin Wimpress 94e0ed4ccf
feat: if --url-all is requested with no OS, list URLs for all supported OS 2024-04-28 14:43:32 +01:00
Martin Wimpress ed855c05a7
refactor: use LANG and EDITION in list_supported() 2024-04-28 14:42:19 +01:00
Martin Wimpress 7c8db64c1b
refactor: make use of _show_url_result() 2024-04-28 14:31:15 +01:00
Martin Wimpress b5caf14aa5
feat: add show_url_results() to consistently present URL listings 2024-04-28 14:30:29 +01:00
Martin Wimpress ecaab037ef
chore: remove url testing and checking from download_windows_workstation() 2024-04-28 14:19:44 +01:00
Martin Wimpress 61442937a9
refactor: use LANG for windows editions 2024-04-28 14:17:51 +01:00
Martin Wimpress ece4de79c9
fix: get macos URL checks working 2024-04-28 14:16:33 +01:00
Martin Wimpress 673ee5ab4a
refactor: use show_test_result() to out URL check results 2024-04-28 13:38:30 +01:00
Martin Wimpress 5520c18df0
feat: add show_test_result() to output iso checks consistently 2024-04-28 13:32:28 +01:00
Martin Wimpress a84454068f
fix: limit void releases to the 3 latest to prevent broken downloads 2024-04-28 13:29:22 +01:00
Martin Wimpress df2abbda89
fix: remove double slashes from get_gentoo() 2024-04-28 13:27:02 +01:00
Martin Wimpress 11ff193543
fix: update get_ubuntu-server() to support 14.04 and 16.04 2024-04-28 13:26:38 +01:00
Martin Wimpress f034178810
fix: always process redirections for zorin .iso images 2024-04-28 13:25:50 +01:00
Martin Wimpress 978d9c997b
fix: update gnomeos to correctly resolve URLs to .iso images 2024-04-28 13:24:39 +01:00
Martin Wimpress 3d36215c64
fix: limit debian releases so missing downloads are not present 2024-04-28 13:21:14 +01:00
Martin Wimpress e9b0fcfa89
fix: validate os in list_check_all() and list_url_all() 2024-04-28 11:07:17 +01:00
Martin Wimpress 6054cbdb69
refactor: change GOOD to CHECK and keep it in local scopes 2024-04-28 11:03:47 +01:00
Martin Wimpress bb8864bb24
refactor: simplify list_check_all() and list_url_all() initialisation 2024-04-28 10:30:20 +01:00
1 changed files with 123 additions and 103 deletions

226
quickget
View File

@ -364,26 +364,23 @@ function create_config() {
function list_supported() {
# output OS RELEASE EDITION (usefull for straight testing...)
local DL=""
local FUNC
local OPTION
local OS
local FUNC=""
local OS=""
for OS in $(os_support); do
case ${OS} in
*ubuntu-server*) FUNC="ubuntu-server";;
*ubuntu*) FUNC="ubuntu";;
*) FUNC="${OS}";;
esac
FUNC="${OS}"
if [[ "${OS}" == *ubuntu* && "${OS}" != "ubuntu-server" ]]; then
FUNC="ubuntu"
fi
for RELEASE in $("releases_${FUNC}" | sed -Ee 's/eol-\S+//g' ); do # hide eol releases
# If the OS has an editions_() function, use it.
if [[ $(type -t "editions_${OS}") == function ]]; then
for OPTION in $(editions_"${OS}"); do
echo "${OS} ${RELEASE} ${OPTION}"
for EDITION in $(editions_"${OS}"); do
echo "${OS} ${RELEASE} ${EDITION}"
done
elif [[ "${OS}" == "windows"* ]]; then
"languages_${OS}"
for OPTION in "${LANGS[@]}"; do
echo "${OS} ${RELEASE} ${OPTION}"
for LANG in "${LANGS[@]}"; do
echo "${OS} ${RELEASE} ${LANG}"
done
else
echo "${OS} ${RELEASE}"
@ -393,37 +390,65 @@ function list_supported() {
exit 0
}
function list_url_all() {
local DIR="/dev/null"
local URL
local FUNC
local OPTION
local OS="${1}"
if [[ "${OS}" == *ubuntu-server* ]]; then
FUNC="ubuntu-server"
elif [[ "${OS}" == *ubuntu* ]]; then
FUNC="ubuntu"
function show_test_result() {
local RESULT="${1}"
local OS="${2}"
local RELEASE="${3}"
local EDITION="${4:-}"
local URL="${5:-}"
if [ -n "${EDITION}" ]; then
OS="${OS}-${RELEASE}-${EDITION}"
else
FUNC="${OS}"
OS="${OS}-${RELEASE}"
fi
# Pad the OS string to 32 characters
OS=$(printf "%-35s" "${OS}")
echo -e "${RESULT}: ${OS} ${URL}"
}
function show_url_result() {
local OS="${1}"
local RELEASE="${2}"
local EDITION="${3:-}"
local URL="${4:-}"
if [ -n "${EDITION}" ]; then
OS="${OS}-${RELEASE}-${EDITION}"
else
OS="${OS}-${RELEASE}"
fi
# Pad the OS string to 32 characters
OS=$(printf "%-35s" "${OS}:")
echo -e "${OS} ${URL}"
}
function list_url_all() {
OS="${1}"
os_supported
local CHECK=""
local FUNC="${OS}"
if [[ "${OS}" == *ubuntu* && "${OS}" != "ubuntu-server" ]]; then
FUNC="ubuntu"
fi
local URL=""
for RELEASE in $("releases_${FUNC}" | sed -Ee 's/eol-\S+//g' ); do # hide eol releases
if [[ $(type -t "editions_${OS}") == function ]]; then
for EDITION in $(editions_"${OS}"); do
validate_release releases_"${OS}"
URL=$(get_"${OS}" | cut_1 | head -1)
echo "${URL}"
show_url_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}"
done
elif [[ "${OS}" == "windows"* ]]; then
"languages_${OS}"
for OPTION in "${LANGS[@]}"; do
for LANG in "${LANGS[@]}"; do
validate_release releases_"${OS}"
echo -e "SKIP:\t${OS}\t${RELEASE}\t${OPTION}\t${URL}"
show_url_result "${OS}" "${RELEASE}" "${LANG}" "SKIP"
done
elif [[ "${OS}" == "macos" ]]; then
validate_release releases_"${OS}"
echo -e "SKIP:\t${OS}\t${RELEASE}"
elif [[ "${OS}" == *ubuntu-server* ]]; then
validate_release releases_macos
(get_macos)
elif [ "${OS}" == "ubuntu-server" ]; then
validate_release releases_ubuntu-server
(get_ubuntu-server)
elif [[ "${OS}" == *ubuntu* ]]; then
@ -432,44 +457,42 @@ function list_url_all() {
else
validate_release releases_"${OS}"
URL=$(get_"${OS}" | cut_1 | head -1)
echo "${URL}"
show_url_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}"
fi
done
exit 0
}
function list_check_all() {
local URL
local FUNC
local OPTION
local OS="${1}"
if [[ "${OS}" == *ubuntu-server* ]]; then
FUNC="ubuntu-server"
elif [[ "${OS}" == *ubuntu* ]]; then
OS="${1}"
os_supported
local CHECK=""
local FUNC="${OS}"
if [[ "${OS}" == *ubuntu* && "${OS}" != "ubuntu-server" ]]; then
FUNC="ubuntu"
else
FUNC="${OS}"
fi
local URL=""
for RELEASE in $("releases_${FUNC}" | sed -Ee 's/eol-\S+//g' ); do # hide eol releases
if [[ $(type -t "editions_${OS}") == function ]]; then
for EDITION in $(editions_"${OS}"); do
validate_release releases_"${OS}"
URL=$(get_"${OS}" | cut_1 | head -1)
GOOD=$(web_check "${URL}" && echo 'PASS' || echo 'FAIL')
echo -e "${GOOD}:\t${OS}\t${RELEASE}\t${EDITION}\t${URL}"
CHECK=$(web_check "${URL}" && echo 'PASS' || echo 'FAIL')
show_test_result ${CHECK} "${OS}" "${RELEASE}" "${EDITION}" "${URL}"
done
else
if [[ "${OS}" == "windows"* ]]; then
"languages_${OS}"
for OPTION in "${LANGS[@]}"; do
for LANG in "${LANGS[@]}"; do
validate_release releases_"${OS}"
echo -e "SKIP:\t${OS}\t${RELEASE}\t${OPTION}\t${URL}"
show_test_result SKIP "${OS}" "${RELEASE}" "${LANG}" "${URL}"
done
elif [[ "${OS}" == "macos" ]]; then
validate_release releases_"${OS}"
echo -e "SKIP:\t${OS}\t${RELEASE}"
elif [[ "${OS}" == *ubuntu-server* ]]; then
validate_release releases_macos
(get_macos)
elif [ "${OS}" == "ubuntu-server" ]; then
validate_release releases_ubuntu-server
(get_ubuntu-server)
elif [[ "${OS}" == *ubuntu* ]]; then
@ -478,8 +501,8 @@ function list_check_all() {
else
validate_release releases_"${OS}"
URL=$(get_"${OS}" | cut_1 | head -1)
GOOD=$(web_check "${URL}" && echo 'PASS' || echo 'FAIL')
echo -e "${GOOD}:\t${OS}\t${RELEASE}\t${EDITION}\t${URL}"
CHECK=$(web_check "${URL}" && echo 'PASS' || echo 'FAIL')
show_test_result ${CHECK} "${OS}" "${RELEASE}" "${EDITION}" "${URL}"
fi
fi
done
@ -628,7 +651,7 @@ function releases_archlinux() {
}
function releases_arcolinux() {
echo $(web_pipe "https://mirror.accum.se/mirror/arcolinux.info/iso/" | grep -o -E ">v[[:digit:]]{2}.[[:digit:]]{2}.[[:digit:]]{2}" | sed -e "s/>//" | sort -r | head -n 5 | tr '\n' ' ')
echo $(web_pipe "https://mirror.accum.se/mirror/arcolinux.info/iso/" | grep -o -E ">v[[:digit:]]{2}.[[:digit:]]{2}.[[:digit:]]{2}" | sed -e "s/>//" | sort -r | head -n 5)
}
function editions_arcolinux() {
@ -652,7 +675,7 @@ function releases_batocera() {
}
function releases_bazzite() {
echo $(web_pipe "https://api.github.com/repos/ublue-os/bazzite/releases" | grep 'download_url' | grep 'sum' | cut -d '/' -f8 | cut -d'v' -f2 | tr '\n' ' ')
echo $(web_pipe "https://api.github.com/repos/ublue-os/bazzite/releases" | grep 'download_url' | grep 'sum' | cut -d '/' -f8 | cut -d'v' -f2 | head -n 5)
}
function releases_biglinux() {
@ -715,9 +738,8 @@ function releases_debian() {
local NEW=""
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)
echo -n "${NEW} "
echo ${OLD}
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)
echo ${NEW} ${OLD}
}
function editions_debian() {
@ -803,8 +825,7 @@ function editions_gentoo() {
}
function releases_ghostbsd() {
web_pipe "https://download.ghostbsd.org/releases/amd64/" | grep "href" | cut -d'"' -f2 | cut -d'/' -f1 | sort -r | tail +3 | head -n 5 | tr '\n' ' '
echo
echo $(web_pipe "https://download.ghostbsd.org/releases/amd64/" | grep "href" | cut -d'"' -f2 | cut -d'/' -f1 | sort -r | tail +3 | head -3)
}
function editions_ghostbsd() {
@ -812,9 +833,7 @@ function editions_ghostbsd() {
}
function releases_gnomeos() {
local GNOMEOS_RELEASES=""
GNOMEOS_RELEASES="$(web_pipe "https://download.gnome.org/gnomeos/" | grep -o -P '(?<=<a href=").*(?=/" title=")' | sort -nr | tr '\n' ' ')"
echo nightly "${GNOMEOS_RELEASES}"
echo "nightly" $(web_pipe "https://download.gnome.org/gnomeos/" | grep -o -P '(?<=<a href=").*(?=/" title=")' | sort -nr)
}
function releases_guix() {
@ -1120,7 +1139,7 @@ function releases_vanillaos() {
}
function releases_void() {
echo $(web_pipe "https://repo-default.voidlinux.org/live/" | grep "^<a href=\"2" | cut -d'"' -f2 | tr -d '/' | sort -ru)
echo $(web_pipe "https://repo-default.voidlinux.org/live/" | grep "^<a href=\"2" | cut -d'"' -f2 | tr -d '/' | sort -ru | head -3)
}
function editions_void() {
@ -1165,7 +1184,7 @@ function releases_zorin() {
}
function editions_zorin() {
echo core64 lite64 education64 edulite64
echo core64 lite64 education64
}
function check_hash() {
@ -1204,6 +1223,7 @@ function web_pipe() {
# Download a file from the web
function web_get() {
local CHECK=""
local HEADERS=()
local URL="${1}"
local DIR="${2}"
@ -1231,11 +1251,11 @@ function web_get() {
# Test mode for ISO
if [ "${just}" == 'show' ]; then
echo "${URL}"
show_url_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}"
exit 0
elif [ "${just}" == 'test' ]; then
GOOD=$(web_check "${URL}" && echo 'PASS' || echo 'FAIL')
echo -e "${GOOD}:\t${OS}\t${RELEASE}\t${EDITION}\t${URL}"
CHECK=$(web_check "${URL}" && echo 'PASS' || echo 'FAIL')
show_test_result "${CHECK}" "${OS}" "${RELEASE}" "${EDITION}" "${URL}"
exit 0
elif [ "${just}" == 'download' ]; then
DIR="$(pwd)"
@ -1876,7 +1896,7 @@ function get_garuda() {
function get_gentoo() {
local HASH=""
local ISO=""
local URL="https://mirror.bytemark.co.uk/gentoo/releases/amd64/autobuilds/"
local URL="https://mirror.bytemark.co.uk/gentoo/releases/amd64/autobuilds"
case ${EDITION} in
minimal) ISO=$(web_pipe "${URL}/${RELEASE}-iso.txt" | grep install | cut_1);;
livegui) ISO=$(web_pipe "${URL}/${RELEASE}-iso.txt" | grep livegui | cut_1);;
@ -1899,24 +1919,18 @@ function get_ghostbsd() {
function get_gnomeos() {
local HASH=""
local ISO=""
local URL=""
local ISO="gnome_os_installer_${RELEASE}.iso"
local URL="https://download.gnome.org/gnomeos/${RELEASE}"
case ${RELEASE} in
nightly)
URL="https://os.gnome.org/download/latest"
ISO="gnome_os_installer.iso";;
# The download.gnome.org mirror does not currently link to ISOs for 44.rc or 45.rc
44.rc|45.rc)
URL="https://mirror.umd.edu/gnome/gnomeos/${RELEASE}"
ISO="gnome_os_installer_${RELEASE}.iso";;
3.38*)
URL="https://download.gnome.org/gnomeos/${RELEASE}"
ISO="gnome_os_installer.iso";;
*)
URL="https://download.gnome.org/gnomeos/${RELEASE}"
ISO="gnome_os_installer_${RELEASE}.iso";;
ISO="gnome_os_installer.iso"
URL="https://os.gnome.org/download/latest";;
46.0) ISO="gnome_os_installer_46.iso";;
3*) ISO="gnome_os_installer.iso";;
esac
echo "${URL}/${ISO} ${HASH}"
# Process the URL redirections; required for GNOME
ISO=$(web_redirect "${URL}/${ISO}")
echo "${ISO} ${HASH}"
}
function get_guix() {
@ -2077,11 +2091,11 @@ function get_macos() {
local chunkListSession=$(echo "$info" | grep 'expires' | grep 'chunklist')
if [ "${just}" == 'show' ]; then
echo -e "Recovery URL (inaccessible through normal browser):\n${downloadLink}\nChunklist (used for verifying the Recovery Image):\n${chunkListLink}\nFirmware URLs:\n${OpenCore_qcow2}\n${OVMF_CODE}\n${OVMF_VARS}"
show_url_result "${OS}" "${RELEASE}" "" "${downloadLink}"
exit 0
elif [ "${just}" == 'test' ]; then
web_check "${downloadLink}" --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${downloadSession}"
web_check "${chunkListLink}" --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${chunkListSession}"
local CHECK=$(web_check "${downloadLink}" --header "Host: oscdn.apple.com" --header "Connection: close" --header "User-Agent: InternetRecovery/1.0" --header "Cookie: AssetToken=${downloadSession}" && echo 'PASS' || echo 'FAIL')
show_test_result ${CHECK} "${OS}" "${RELEASE}" "" "${downloadLink}"
exit 0
elif [ "${just}" == 'download' ]; then
echo "Downloading macOS ${RELEASE} from ${downloadLink}"
@ -2507,6 +2521,7 @@ function get_tuxedoos() {
function get_ubuntu-server() {
local HASH=""
local ISO=""
local NAME="live-server"
local URL=""
[[ $RELEASE = daily ]] && RELEASE=daily-live
if [[ "${RELEASE}" == "daily"* ]]; then
@ -2514,19 +2529,20 @@ function get_ubuntu-server() {
else
URL="https://releases.ubuntu.com/${RELEASE}"
fi
case "${RELEASE}" in
14*|16*) NAME="server";;
esac
if web_check "${URL}/SHA256SUMS"; then
DATA=$(web_pipe "${URL}/SHA256SUMS" | grep 'live-server' | grep amd64 | grep iso)
DATA=$(web_pipe "${URL}/SHA256SUMS" | grep "${NAME}" | grep amd64 | grep iso)
ISO=$(cut -d'*' -f2 <<<${DATA})
HASH=$(cut_1 <<<${DATA})
else
DATA=$(web_pipe "${URL}/MD5SUMS" | grep 'live-server' | grep amd64 | grep iso)
DATA=$(web_pipe "${URL}/MD5SUMS" | grep "${NAME}" | grep amd64 | grep iso)
ISO=$(cut -d' ' -f3 <<<${DATA})
HASH=$(cut_1 <<<${DATA})
fi
if [ -z $ISO ] || [ -z $HASH ]; then
echo "$(pretty_name $OS) ${RELEASE} is currently unavailable. Please select other OS/Release combination"
exit 1
fi
if [[ "${RELEASE}" == "daily"* ]] || [ "${RELEASE}" == "dvd" ]; then
zsync_get "${URL}/${ISO}" "${VM_PATH}" "${OS}-devel.iso"
make_vm_config "${OS}-devel.iso"
@ -2624,7 +2640,8 @@ function get_zorin() {
local HASH=""
local ISO=""
local URL=""
URL="https://zrn.co/${RELEASE}${EDITION}"
# Process the URL redirections; required for Zorin
URL=$(web_redirect "https://zrn.co/${RELEASE}${EDITION}")
echo "${URL} ${HASH}"
}
@ -3210,9 +3227,6 @@ function download_windows_workstation() {
if echo "$iso_download_link_html" | grep -q "We are unable to complete your request at this time."; then
echo " - Microsoft blocked the automated download request based on your IP address."
if [ "${just}" == 'show' ] || [ "${just}" == 'test' ]; then
exit 1
fi
failed=1
fi
@ -3235,14 +3249,6 @@ function download_windows_workstation() {
return 1
fi
if [ "${just}" == 'show' ]; then
echo -e " Windows ${RELEASE} Download (valid for 24 hours):\n${iso_download_link}"
exit 0
elif [ "${just}" == 'test' ]; then
web_check "${iso_download_link}"
exit 0
fi
echo "Downloading Windows ${RELEASE} (${LANG}): $iso_download_link"
# Download ISO
@ -3445,7 +3451,14 @@ case "${1}" in
'--url-all'|'-ua')
just="show"
shift
list_url_all "${1}"
# if no OS is specified, list all URLs for all supported OSes
if [ -z "${1}" ]; then
for OS in $(os_support); do
(list_url_all "${OS}")
done
else
list_url_all "${1}"
fi
;;
'--check'|'-c')
just="test"
@ -3454,7 +3467,14 @@ case "${1}" in
'--check-all'|'-ca')
just="test"
shift
list_check_all "${1}"
# if no OS is specified, check all URLs for all supported OSes
if [ -z "${1}" ]; then
for OS in $(os_support); do
(list_check_all "${OS}")
done
else
list_check_all "${1}"
fi
;;
#TODO: Argument without dashes should be DEPRECATED!
'--list-csv'|'-lc'|'list'|'list_csv'|'lc')