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,10 +152,13 @@ i386) arch="x86" ;;
|
|||
esac
|
||||
|
||||
# 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" ] && {
|
||||
echo "failed to fetch $title latest version"
|
||||
exit 1
|
||||
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
|
||||
}
|
||||
}
|
||||
title="$title $version"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue