Compare commits

...

8 Commits

Author SHA1 Message Date
zenobit a7b220c0a0
Merge 418aa23ea0 into 04b37ccf02 2024-05-04 10:41:31 +02:00
Martin Wimpress 04b37ccf02 refactor: make zsync_get() consistent with other checks 2024-05-04 09:03:44 +01:00
Martin Wimpress 2e1b556b93 fix: correctly format url show daily-live tests 2024-05-04 09:03:44 +01:00
Martin Wimpress c693dc9ba7 fix: prevent daily-live images being downloaded during test 2024-05-04 09:03:44 +01:00
zen0bit 50817d2dba fix: correct shellcheck error 2068 2024-05-04 09:03:44 +01:00
zen0bit 418aa23ea0 Remove unused pretty_name function 2024-05-03 06:30:18 +02:00
zen0bit e34ad52f50 Change DISPLAY_NAME to PRETTY_NAME 2024-05-03 06:30:18 +02:00
zen0bit 9f5be6a2a1 Add PRETTY_NAME variable 2024-05-03 06:30:18 +02:00
1 changed files with 28 additions and 38 deletions

View File

@ -151,9 +151,7 @@ function show_os_info() {
done
}
function pretty_name() {
echo $(show_os_info -1 "${1}")
}
PRETTY_NAME=$(show_os_info -1 "${OS}")
# Just in case quickget want use it
function os_homepage(){
@ -225,7 +223,7 @@ function error_not_supported_os() {
function error_not_supported_release() {
if [[ ! " ${RELEASES[*]} " =~ " ${RELEASE} " ]]; then
echo -e "ERROR! ${DISPLAY_NAME} ${RELEASE} is not a supported release."
echo -e "ERROR! ${PRETTY_NAME} ${RELEASE} is not a supported release."
echo -n 'Supported releases: '
"releases_${OS}"
exit 1
@ -234,7 +232,7 @@ function error_not_supported_release() {
function error_not_supported_edition() {
if [[ ! " ${EDITIONS[*]} " =~ " ${EDITION} " ]]; then
echo -e "ERROR! ${EDITION} is not a supported $(pretty_name "${OS}") edition\n"
echo -e "ERROR! ${EDITION} is not a supported ${PRETTY_NAME} edition\n"
echo -n ' - Editions: '
for EDITION in "${EDITIONS[@]}"; do
echo -n "${EDITION} "
@ -245,7 +243,7 @@ function error_not_supported_edition() {
}
function error_not_supported_lang() {
echo -e "ERROR! ${LANG} is not a supported $(pretty_name "${OS}") language\n"
echo -e "ERROR! ${LANG} is not a supported ${PRETTY_NAME} language\n"
echo -n ' - Editions: '
for LANG in "${LANGS[@]}"; do
echo -n "${LANG} "
@ -273,11 +271,9 @@ function handle_missing() {
}
function validate_release() {
local DISPLAY_NAME=""
local PRETTY_NAME=""
local RELEASE_GENERATOR=""
local RELEASES=""
DISPLAY_NAME="$(pretty_name "${OS}")"
case ${OS} in
*ubuntu-server*) RELEASE_GENERATOR="releases_ubuntu-server";;
*ubuntu*) RELEASE_GENERATOR="releases_ubuntu";;
@ -295,15 +291,12 @@ function list_json() {
function list_csv() {
CSV_DATA="$(csv_data)"
echo "Display Name,OS,Release,Option,Downloader,PNG,SVG"
sort -t',' -k2,2 <<<"${CSV_DATA}"
sort -f <<<"${CSV_DATA}"
exit 0
}
function csv_data() {
local DISPLAY_NAME
local PRETTY_NAME
local DL=""
local DOWNLOADER
local FUNC
@ -321,8 +314,8 @@ function csv_data() {
for OS in $(os_support); do
local EDITIONS=""
DISPLAY_NAME="$(pretty_name "${OS}")"
echo "Pretty Name,OS,Release,Option,Downloader,PNG,SVG"
for OS in $(os_support); do
case ${OS} in
*ubuntu-server*) FUNC="ubuntu-server";;
*ubuntu*) FUNC="ubuntu";;
@ -346,15 +339,15 @@ function csv_data() {
# If the OS has an editions_() function, use it.
if [[ ${EDITIONS} ]]; then
for OPTION in ${EDITIONS}; do
echo "${DISPLAY_NAME},${OS},${RELEASE},${OPTION},${DOWNLOADER},${PNG},${SVG}"
echo "${PRETTY_NAME},${OS},${RELEASE},${OPTION},${DOWNLOADER},${PNG},${SVG}"
done
elif [[ "${OS}" == "windows"* ]]; then
"languages_${OS}"
for LANG in "${LANGS[@]}"; do
echo "${DISPLAY_NAME},${OS},${RELEASE},${LANG},${DOWNLOADER},${PNG},${SVG}"
echo "${PRETTY_NAME},${OS},${RELEASE},${LANG},${DOWNLOADER},${PNG},${SVG}"
done
else
echo "${DISPLAY_NAME},${OS},${RELEASE},,${DOWNLOADER},${PNG},${SVG}"
echo "${PRETTY_NAME},${OS},${RELEASE},,${DOWNLOADER},${PNG},${SVG}"
fi
done &
done
@ -1099,22 +1092,22 @@ function releases_ubuntu() {
local EOL_VERSIONS=($(IFS=$'\n' jq -r 'select(.status=="Obsolete") | .version' <<<${VERSION_DATA} | sort))
case "${OS}" in
ubuntu)
echo ${SUPPORTED_VERSIONS[@]} daily-live ${EOL_VERSIONS[@]/#/eol-};;
echo "${SUPPORTED_VERSIONS[@]}" daily-live "${EOL_VERSIONS[@]/#/eol-}";;
kubuntu|lubuntu|ubuntukylin|ubuntu-mate|ubuntustudio|xubuntu)
# after 16.04
echo ${SUPPORTED_VERSIONS[@]:1} daily-live ${EOL_VERSIONS[@]/#/eol-};;
echo "${SUPPORTED_VERSIONS[@]:1}" daily-live "${EOL_VERSIONS[@]/#/eol-}";;
ubuntu-budgie)
# after 18.04
echo ${SUPPORTED_VERSIONS[@]:2} daily-live ${EOL_VERSIONS[@]/#/eol-};;
echo "${SUPPORTED_VERSIONS[@]:2}" daily-live "${EOL_VERSIONS[@]/#/eol-}";;
edubuntu|ubuntu-unity|ubuntucinnamon)
# after 23.10
echo ${SUPPORTED_VERSIONS[@]:5} daily-live ${EOL_VERSIONS[@]/#/eol-};;
echo "${SUPPORTED_VERSIONS[@]:5}" daily-live "${EOL_VERSIONS[@]/#/eol-}";;
esac
}
function releases_ubuntu-server() {
local ALL_VERSIONS=($(IFS=$'\n' web_pipe http://releases.ubuntu.com/streams/v1/com.ubuntu.releases:ubuntu-server.json | jq -r '.products[] | select(.arch=="amd64") | .version' | sort -rV))
echo ${ALL_VERSIONS[@]}
echo "${ALL_VERSIONS[@]}"
}
function releases_vanillaos() {
@ -1250,7 +1243,7 @@ function web_get() {
fi
if [[ ${OS} != windows && ${OS} != macos && ${OS} != windows-server ]]; then
echo Downloading $(pretty_name "${OS}") ${RELEASE} ${EDITION:+ $EDITION}
echo Downloading ${PRETTY_NAME} ${RELEASE} ${EDITION:+ $EDITION}
echo "- URL: ${URL}"
fi
@ -1290,22 +1283,19 @@ function web_check() {
}
function zsync_get() {
local CHECK=""
local DIR="${2}"
local FILE="${1##*/}"
local OUT=""
local URL="${1}"
# Test mode for ISO
if [ "${OPERATION}" == "show" ]; then
echo "${URL}"
test_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}"
exit 0
elif [ "${OPERATION}" == "test" ]; then
CHECK=$(web_check "${URL}" && echo 'PASS' || echo 'FAIL')
test_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}" "${CHECK}"
exit 0
elif [ "${OPERATION}" == "check" ]; then
if ! web_check "${URL}"; then
check_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}" "FAIL"
exit 0
else
check_result "${OS}" "${RELEASE}" "${EDITION}" "${URL}" "PASS"
exit 0
fi
elif command -v zsync &>/dev/null; then
if [ -n "${3}" ]; then
OUT="${3}"
@ -1317,7 +1307,7 @@ function zsync_get() {
echo "ERROR! Unable to create directory ${DIR}"
exit 1
fi
echo -e Downloading $(pretty_name "${OS}") ${RELEASE} ${EDITION+ ${EDITION}} from ${URL}'\n'
echo -e Downloading ${PRETTY_NAME} ${RELEASE} ${EDITION+ ${EDITION}} from ${URL}'\n'
# Only force http for zsync - not earlier because we might fall through here
if ! zsync "${URL/https/http}.zsync" -i "${DIR}/${OUT}" -o "${DIR}/${OUT}" 2>/dev/null; then
echo "ERROR! Failed to download ${URL/https/http}.zsync"
@ -1513,7 +1503,7 @@ EOF
echo "secureboot=\"off\"" >> "${CONF_FILE}"
fi
fi
echo -e "\nTo start your $(pretty_name "${OS}") virtual machine run:"
echo -e "\nTo start your ${PRETTY_NAME} virtual machine run:"
if [ ${OS} == "slint" ]; then
echo -e " quickemu --vm ${CONF_FILE}\nTo start Slint with braille support run:\n quickemu --vm --braille --display sdl ${CONF_FILE}"
else
@ -2574,7 +2564,7 @@ function get_ubuntu() {
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"
echo "${PRETTY_NAME} ${RELEASE} is currently unavailable. Please select other OS/Release combination"
exit 1
fi
if [[ "${RELEASE}" == "daily"* ]] || [ "${RELEASE}" == "dvd" ]; then
@ -3123,7 +3113,7 @@ function download_windows_server() {
# Limit untrusted size for input validation
iso_download_link="$(echo "$iso_download_link" | head -c 1024)"
echo "Downloading $(pretty_name "${OS}") ${PRETTY_RELEASE} (${LANG}): $iso_download_link"
echo "Downloading ${PRETTY_NAME} ${PRETTY_RELEASE} (${LANG}): $iso_download_link"
# Use highest TLS version for endpoints that support it
case "$iso_download_link" in