mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 19:14:27 +05:00
fix(mainsail/fluidd): fall back to latest stable url if fetching tags fails (#348)
This commit is contained in:
@@ -341,27 +341,28 @@ function compare_fluidd_versions() {
|
|||||||
#================================================#
|
#================================================#
|
||||||
|
|
||||||
function get_fluidd_download_url() {
|
function get_fluidd_download_url() {
|
||||||
local fl_tags tags latest_tag latest_url stable_tag stable_url url
|
local releases_by_tag tags tag unstable_url url
|
||||||
|
|
||||||
fl_tags="https://api.github.com/repos/fluidd-core/fluidd/tags"
|
### latest stable download url
|
||||||
tags=$(curl -s "${fl_tags}" | grep "name" | cut -d'"' -f4)
|
url="https://github.com/fluidd-core/fluidd/releases/latest/download/fluidd.zip"
|
||||||
|
|
||||||
### latest download url including pre-releases (alpha, beta, rc)
|
|
||||||
latest_tag=$(echo "${tags}" | head -1)
|
|
||||||
latest_url="https://github.com/fluidd-core/fluidd/releases/download/${latest_tag}/fluidd.zip"
|
|
||||||
|
|
||||||
### get stable fluidd download url
|
|
||||||
stable_tag=$(echo "${tags}" | grep -E "^v([0-9]+\.?){3}$" | head -1)
|
|
||||||
stable_url="https://github.com/fluidd-core/fluidd/releases/download/${stable_tag}/fluidd.zip"
|
|
||||||
|
|
||||||
read_kiauh_ini "${FUNCNAME[0]}"
|
read_kiauh_ini "${FUNCNAME[0]}"
|
||||||
if [[ ${fluidd_install_unstable} == "true" ]]; then
|
if [[ ${fluidd_install_unstable} == "true" ]]; then
|
||||||
url="${latest_url}"
|
releases_by_tag="https://api.github.com/repos/fluidd-core/fluidd/tags"
|
||||||
echo "${url}"
|
tags=$(curl -s "${releases_by_tag}" | grep "name" | cut -d'"' -f4)
|
||||||
|
tag=$(echo "${tags}" | head -1)
|
||||||
|
|
||||||
|
### latest unstable download url including pre-releases (alpha, beta, rc)
|
||||||
|
unstable_url="https://github.com/fluidd-core/fluidd/releases/download/${tag}/fluidd.zip"
|
||||||
|
|
||||||
|
if [[ ${unstable_url} == *"download//"* ]]; then
|
||||||
|
warn_msg "Download URL broken! Falling back to URL of latest stable release!"
|
||||||
else
|
else
|
||||||
url="${stable_url}"
|
url=${unstable_url}
|
||||||
echo "${url}"
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${url}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function fluidd_port_check() {
|
function fluidd_port_check() {
|
||||||
|
|||||||
@@ -511,27 +511,28 @@ function ms_theme_delete() {
|
|||||||
#================================================#
|
#================================================#
|
||||||
|
|
||||||
function get_mainsail_download_url() {
|
function get_mainsail_download_url() {
|
||||||
local ms_tags tags latest_tag latest_url stable_tag stable_url url
|
local releases_by_tag tags tag unstable_url url
|
||||||
|
|
||||||
ms_tags="https://api.github.com/repos/mainsail-crew/mainsail/tags"
|
### latest stable download url
|
||||||
tags=$(curl -s "${ms_tags}" | grep "name" | cut -d'"' -f4)
|
url="https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip"
|
||||||
|
|
||||||
### latest download url including pre-releases (alpha, beta, rc)
|
|
||||||
latest_tag=$(echo "${tags}" | head -1)
|
|
||||||
latest_url="https://github.com/mainsail-crew/mainsail/releases/download/${latest_tag}/mainsail.zip"
|
|
||||||
|
|
||||||
### get stable mainsail download url
|
|
||||||
stable_tag=$(echo "${tags}" | grep -E "^v([0-9]+\.?){3}$" | head -1)
|
|
||||||
stable_url="https://github.com/mainsail-crew/mainsail/releases/download/${stable_tag}/mainsail.zip"
|
|
||||||
|
|
||||||
read_kiauh_ini "${FUNCNAME[0]}"
|
read_kiauh_ini "${FUNCNAME[0]}"
|
||||||
if [[ ${mainsail_install_unstable} == "true" ]]; then
|
if [[ ${mainsail_install_unstable} == "true" ]]; then
|
||||||
url="${latest_url}"
|
releases_by_tag="https://api.github.com/repos/mainsail-crew/mainsail/tags"
|
||||||
echo "${url}"
|
tags=$(curl -s "${releases_by_tag}" | grep "name" | cut -d'"' -f4)
|
||||||
|
tag=$(echo "${tags}" | head -1)
|
||||||
|
|
||||||
|
### latest unstable download url including pre-releases (alpha, beta, rc)
|
||||||
|
unstable_url="https://github.com/mainsail-crew/mainsail/releases/download/${tag}/mainsail.zip"
|
||||||
|
|
||||||
|
if [[ ${unstable_url} == *"download//"* ]]; then
|
||||||
|
warn_msg "Download URL broken! Falling back to URL of latest stable release!"
|
||||||
else
|
else
|
||||||
url="${stable_url}"
|
url=${unstable_url}
|
||||||
echo "${url}"
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${url}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function mainsail_port_check() {
|
function mainsail_port_check() {
|
||||||
|
|||||||
Reference in New Issue
Block a user