This commit is contained in:
zenobit 2024-05-04 10:41:31 +02:00 committed by GitHub
commit a7b220c0a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -151,9 +151,7 @@ function show_os_info() {
done done
} }
function pretty_name() { PRETTY_NAME=$(show_os_info -1 "${OS}")
echo $(show_os_info -1 "${1}")
}
# Just in case quickget want use it # Just in case quickget want use it
function os_homepage(){ function os_homepage(){
@ -225,7 +223,7 @@ function error_not_supported_os() {
function error_not_supported_release() { function error_not_supported_release() {
if [[ ! " ${RELEASES[*]} " =~ " ${RELEASE} " ]]; then 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: ' echo -n 'Supported releases: '
"releases_${OS}" "releases_${OS}"
exit 1 exit 1
@ -234,7 +232,7 @@ function error_not_supported_release() {
function error_not_supported_edition() { function error_not_supported_edition() {
if [[ ! " ${EDITIONS[*]} " =~ " ${EDITION} " ]]; then 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: ' echo -n ' - Editions: '
for EDITION in "${EDITIONS[@]}"; do for EDITION in "${EDITIONS[@]}"; do
echo -n "${EDITION} " echo -n "${EDITION} "
@ -245,7 +243,7 @@ function error_not_supported_edition() {
} }
function error_not_supported_lang() { 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: ' echo -n ' - Editions: '
for LANG in "${LANGS[@]}"; do for LANG in "${LANGS[@]}"; do
echo -n "${LANG} " echo -n "${LANG} "
@ -273,11 +271,9 @@ function handle_missing() {
} }
function validate_release() { function validate_release() {
local DISPLAY_NAME="" local PRETTY_NAME=""
local RELEASE_GENERATOR="" local RELEASE_GENERATOR=""
local RELEASES="" local RELEASES=""
DISPLAY_NAME="$(pretty_name "${OS}")"
case ${OS} in case ${OS} in
*ubuntu-server*) RELEASE_GENERATOR="releases_ubuntu-server";; *ubuntu-server*) RELEASE_GENERATOR="releases_ubuntu-server";;
*ubuntu*) RELEASE_GENERATOR="releases_ubuntu";; *ubuntu*) RELEASE_GENERATOR="releases_ubuntu";;
@ -295,15 +291,12 @@ function list_json() {
function list_csv() { function list_csv() {
CSV_DATA="$(csv_data)" CSV_DATA="$(csv_data)"
sort -f <<<"${CSV_DATA}"
echo "Display Name,OS,Release,Option,Downloader,PNG,SVG"
sort -t',' -k2,2 <<<"${CSV_DATA}"
exit 0 exit 0
} }
function csv_data() { function csv_data() {
local DISPLAY_NAME local PRETTY_NAME
local DL="" local DL=""
local DOWNLOADER local DOWNLOADER
local FUNC local FUNC
@ -321,8 +314,8 @@ function csv_data() {
for OS in $(os_support); do for OS in $(os_support); do
local EDITIONS="" 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 case ${OS} in
*ubuntu-server*) FUNC="ubuntu-server";; *ubuntu-server*) FUNC="ubuntu-server";;
*ubuntu*) FUNC="ubuntu";; *ubuntu*) FUNC="ubuntu";;
@ -346,15 +339,15 @@ function csv_data() {
# If the OS has an editions_() function, use it. # If the OS has an editions_() function, use it.
if [[ ${EDITIONS} ]]; then if [[ ${EDITIONS} ]]; then
for OPTION in ${EDITIONS}; do for OPTION in ${EDITIONS}; do
echo "${DISPLAY_NAME},${OS},${RELEASE},${OPTION},${DOWNLOADER},${PNG},${SVG}" echo "${PRETTY_NAME},${OS},${RELEASE},${OPTION},${DOWNLOADER},${PNG},${SVG}"
done done
elif [[ "${OS}" == "windows"* ]]; then elif [[ "${OS}" == "windows"* ]]; then
"languages_${OS}" "languages_${OS}"
for LANG in "${LANGS[@]}"; do for LANG in "${LANGS[@]}"; do
echo "${DISPLAY_NAME},${OS},${RELEASE},${LANG},${DOWNLOADER},${PNG},${SVG}" echo "${PRETTY_NAME},${OS},${RELEASE},${LANG},${DOWNLOADER},${PNG},${SVG}"
done done
else else
echo "${DISPLAY_NAME},${OS},${RELEASE},,${DOWNLOADER},${PNG},${SVG}" echo "${PRETTY_NAME},${OS},${RELEASE},,${DOWNLOADER},${PNG},${SVG}"
fi fi
done & done &
done done
@ -1250,7 +1243,7 @@ function web_get() {
fi fi
if [[ ${OS} != windows && ${OS} != macos && ${OS} != windows-server ]]; then 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}" echo "- URL: ${URL}"
fi fi
@ -1314,7 +1307,7 @@ function zsync_get() {
echo "ERROR! Unable to create directory ${DIR}" echo "ERROR! Unable to create directory ${DIR}"
exit 1 exit 1
fi 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 # 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 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" echo "ERROR! Failed to download ${URL/https/http}.zsync"
@ -1510,7 +1503,7 @@ EOF
echo "secureboot=\"off\"" >> "${CONF_FILE}" echo "secureboot=\"off\"" >> "${CONF_FILE}"
fi fi
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 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}" echo -e " quickemu --vm ${CONF_FILE}\nTo start Slint with braille support run:\n quickemu --vm --braille --display sdl ${CONF_FILE}"
else else
@ -2571,7 +2564,7 @@ function get_ubuntu() {
HASH=$(cut_1 <<<${DATA}) HASH=$(cut_1 <<<${DATA})
fi fi
if [ -z $ISO ] || [ -z $HASH ]; then 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 exit 1
fi fi
if [[ "${RELEASE}" == "daily"* ]] || [ "${RELEASE}" == "dvd" ]; then if [[ "${RELEASE}" == "daily"* ]] || [ "${RELEASE}" == "dvd" ]; then
@ -3120,7 +3113,7 @@ function download_windows_server() {
# Limit untrusted size for input validation # Limit untrusted size for input validation
iso_download_link="$(echo "$iso_download_link" | head -c 1024)" 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 # Use highest TLS version for endpoints that support it
case "$iso_download_link" in case "$iso_download_link" in