Add curl option when download cuckoo_generator

To avoid Github rate limit issues.
In shared environment(like a Circle CI), run script could hit a Github API rate limit.
This commit is contained in:
susan335 2019-02-14 15:57:03 +09:00 committed by Matyáš Kříž
parent b0b64cf503
commit b97e7c3dda
1 changed files with 5 additions and 1 deletions

6
run
View File

@ -6,7 +6,11 @@ FILE_PATH="$SCRIPT_PATH/$FILE_NAME"
GREP_OPTIONS=""
function perform_curl {
curl -Lo ${FILE_NAME} `curl "$1" | grep -oe '"browser_download_url":\s*"[^" ]*"' | grep -oe 'http[^" ]*' | grep ${FILE_NAME} | head -1`
if [[ ! -z "$GITHUB_ACCESS_TOKEN" ]]; then
REQUEST_HEADER="-H 'Authorization: token ${GITHUB_ACCESS_TOKEN}'"
fi
eval curl ${REQUEST_HEADER} -Lo ${FILE_NAME} `eval curl $REQUEST_HEADER "$1" | grep -oe '"browser_download_url":\s*"[^" ]*"' | grep -oe 'http[^" ]*' | grep ${FILE_NAME} | head -1`
}
function download_generator {