Add proper fallback since anonymous API calls to GitHub are very limited (#4067)

* Add proper fallback since anonymous API calls to GitHub are very limited
This commit is contained in:
Igor Pečovnik
2022-08-13 09:54:20 +02:00
committed by GitHub
parent 23e4710bdd
commit af6ceee6c5

View File

@@ -32,8 +32,9 @@ cd "${SRC}" || exit
# if variable not provided, check which is current version in the cache storage
if [[ -z "${ROOTFSCACHE_VERSION}" ]]; then
ROOTFSCACHE_VERSION=$(curl https://api.github.com/repos/armbian/cache/releases/latest -s | jq .tag_name -r || true)
ROOTFSCACHE_VERSION=${ROOTFSCACHE_VERSION:-"0003"}
ROOTFSCACHE_VERSION=$(curl https://api.github.com/repos/armbian/cache/releases/latest -s --fail | jq .tag_name -r || true)
# anonymous API access is very limited which is why we need a fallback
ROOTFSCACHE_VERSION=${ROOTFSCACHE_VERSION:-$(curl -L --silent https://cache.armbian.com/rootfs/latest --fail)}
fi
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7