mirror of
https://github.com/GAM-team/GAM.git
synced 2025-05-12 12:17:20 +00:00
gam-install.sh: check curl response code
This commit is contained in:
parent
d0b7ac80da
commit
39e5a45d72
@ -120,14 +120,24 @@ else
|
||||
curl_opts=( "$GHCLIENT" )
|
||||
fi
|
||||
echo_yellow "Checking GitHub URL $release_url for $gamversion GAM release ($check_type)..."
|
||||
release_json=$(curl \
|
||||
release_response=$(curl \
|
||||
--silent \
|
||||
"${curl_opts[@]}" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"$release_url" \
|
||||
-w "%{http_code}" \
|
||||
2>&1 /dev/null)
|
||||
|
||||
response_status="${release_response: -3}"
|
||||
release_json="${release_response:0:-4}"
|
||||
if [ "$response_status" != "200" ]; then
|
||||
echo_red "ERROR when retrieving ${release_url}:\n\n${release_json}"
|
||||
exit
|
||||
else
|
||||
echo_green "done"
|
||||
fi
|
||||
|
||||
echo_yellow "Getting file and download URL..."
|
||||
# Python is sadly the nearest to universal way to safely handle JSON with Bash
|
||||
# At least this code should be compatible with just about any Python version ever
|
||||
|
Loading…
x
Reference in New Issue
Block a user