feat: allow custom MaaS download base URL

This commit is contained in:
Peter Šurda 2021-03-03 12:21:27 +01:00
parent e778036d97
commit c4544b24a5
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
1 changed files with 6 additions and 1 deletions

View File

@ -37,12 +37,17 @@ function file_url()
{ {
local release_version="$1" local release_version="$1"
local filename="$2" local filename="$2"
local baseurl="https://images.maas.io/ephemeral-v3/stable/"
if [ ! -f "$streams" ]; then if [ ! -f "$streams" ]; then
return 1 return 1
fi fi
url=$(jq -r '.products[]|select(.version=="'"$OS_VERSION"'" and .arch=="amd64" and .kflavor=="generic" and .subarch=="ga-'"$OS_VERSION"'").versions."'"$release_version"'".items."'"$filename"'".path' \ url=$(jq -r '.products[]|select(.version=="'"$OS_VERSION"'" and .arch=="amd64" and .kflavor=="generic" and .subarch=="ga-'"$OS_VERSION"'").versions."'"$release_version"'".items."'"$filename"'".path' \
"$streams") "$streams")
url="https://images.maas.io/ephemeral-v3/stable/$url" if [ -n "$MAAS_DOWNLOAD_URL" ]; then
baseurl="$MAAS_DOWNLOAD_URL"
fi
url="$baseurl/$url"
} }
function download_and_verify() function download_and_verify()