mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-04 04:41:35 +00:00
gam-install.sh: check curl response code
This commit is contained in:
@@ -120,14 +120,24 @@ else
|
|||||||
curl_opts=( "$GHCLIENT" )
|
curl_opts=( "$GHCLIENT" )
|
||||||
fi
|
fi
|
||||||
echo_yellow "Checking GitHub URL $release_url for $gamversion GAM release ($check_type)..."
|
echo_yellow "Checking GitHub URL $release_url for $gamversion GAM release ($check_type)..."
|
||||||
release_json=$(curl \
|
release_response=$(curl \
|
||||||
--silent \
|
--silent \
|
||||||
"${curl_opts[@]}" \
|
"${curl_opts[@]}" \
|
||||||
-H "Accept: application/vnd.github+json" \
|
-H "Accept: application/vnd.github+json" \
|
||||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
"$release_url" \
|
"$release_url" \
|
||||||
|
-w "%{http_code}" \
|
||||||
2>&1 /dev/null)
|
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..."
|
echo_yellow "Getting file and download URL..."
|
||||||
# Python is sadly the nearest to universal way to safely handle JSON with Bash
|
# 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
|
# At least this code should be compatible with just about any Python version ever
|
||||||
|
|||||||
Reference in New Issue
Block a user