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:
parent
9fd1e1f763
commit
688cb97ad5
1 changed files with 6 additions and 3 deletions
|
|
@ -152,11 +152,14 @@ 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"
|
||||||
|
|
||||||
if [ "$debug" -eq 1 ]; then
|
if [ "$debug" -eq 1 ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue