refactor: simplify list_check_all() and list_url_all() initialisation

This commit is contained in:
Martin Wimpress 2024-04-28 10:30:20 +01:00 committed by Martin Wimpress
parent 752afa56f4
commit 4be78cffb5

View File

@ -394,17 +394,12 @@ function list_supported() {
}
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
local FUNC="${OS}"
if [[ "${OS}" == *ubuntu* && "${OS}" != "ubuntu-server" ]]; then
FUNC="ubuntu"
else
FUNC="${OS}"
fi
for RELEASE in $("releases_${FUNC}" | sed -Ee 's/eol-\S+//g' ); do # hide eol releases
@ -423,7 +418,7 @@ function list_url_all() {
elif [[ "${OS}" == "macos" ]]; then
validate_release releases_"${OS}"
echo -e "SKIP:\t${OS}\t${RELEASE}"
elif [[ "${OS}" == *ubuntu-server* ]]; then
elif [ "${OS}" == "ubuntu-server" ]; then
validate_release releases_ubuntu-server
(get_ubuntu-server)
elif [[ "${OS}" == *ubuntu* ]]; then
@ -440,15 +435,11 @@ function list_url_all() {
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
local FUNC="${OS}"
if [[ "${OS}" == *ubuntu* && "${OS}" != "ubuntu-server" ]]; then
FUNC="ubuntu"
else
FUNC="${OS}"
fi
for RELEASE in $("releases_${FUNC}" | sed -Ee 's/eol-\S+//g' ); do # hide eol releases
@ -469,7 +460,7 @@ function list_check_all() {
elif [[ "${OS}" == "macos" ]]; then
validate_release releases_"${OS}"
echo -e "SKIP:\t${OS}\t${RELEASE}"
elif [[ "${OS}" == *ubuntu-server* ]]; then
elif [ "${OS}" == "ubuntu-server" ]; then
validate_release releases_ubuntu-server
(get_ubuntu-server)
elif [[ "${OS}" == *ubuntu* ]]; then