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
1 changed files with 17 additions and 24 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
@ -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
@ -1314,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"
@ -1510,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
@ -2571,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
@ -3120,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