install: use jq for parsing json API responses and fallback to flow-control.dev if github is limited or down

This commit is contained in:
CJ van den Berg 2025-10-22 13:01:59 +02:00
parent 9fd1e1f763
commit 688cb97ad5
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -152,10 +152,13 @@ i386) arch="x86" ;;
esac esac
# get latest version tag from github releases api # get latest version tag from github releases api
version=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep '"tag_name":' | cut -d'"' -f4) version=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | jq -r .tag_name)
[ -z "$version" ] && { [ -z "$version" ] && {
echo "failed to fetch $title latest version" version=$(curl -s https://git.flow-control.dev/api/v1/repos/$repo/releases/latest | jq -r .tag_name)
[ -z "$version" ] && {
echo "failed to fetch $title latest version from github or flow-control.dev"
exit 1 exit 1
}
} }
title="$title $version" title="$title $version"