From c1ee9d8bc62a9c2aabcf21a530107366cbcf84d3 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Wed, 1 Jul 2020 13:31:41 +0000 Subject: [PATCH] Fix download retry helper (#1110) * Fix download helper * Fix download helper * Add compressed flag to helper * Minor fix * Minor fix --- images/linux/scripts/helpers/install.sh | 9 ++++++++- images/linux/scripts/installers/pypy.sh | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/images/linux/scripts/helpers/install.sh b/images/linux/scripts/helpers/install.sh index 20a9822b..0843983e 100644 --- a/images/linux/scripts/helpers/install.sh +++ b/images/linux/scripts/helpers/install.sh @@ -11,12 +11,19 @@ download_with_retries() { local URL="$1" local DEST="${2:-.}" local NAME="${3:-${URL##*/}}" + local COMPRESSED="$4" + + if [ $COMPRESSED == "compressed" ]; then + COMMAND="curl $URL -4 -s --compressed -o '$DEST/$NAME'" + else + COMMAND="curl $URL -4 -s -o '$DEST/$NAME'" + fi echo "Downloading $URL..." i=20 while [ $i -gt 0 ]; do ((i--)) - curl $URL -4 -s -compressed -o "$DEST/$NAME" + eval $COMMAND if [ $? != 0 ]; then sleep 30 else diff --git a/images/linux/scripts/installers/pypy.sh b/images/linux/scripts/installers/pypy.sh index dc6d1c77..e47235af 100644 --- a/images/linux/scripts/installers/pypy.sh +++ b/images/linux/scripts/installers/pypy.sh @@ -72,7 +72,7 @@ function InstallPyPy # Installation PyPy uri="https://downloads.python.org/pypy/" -download_with_retries $uri "/tmp" "pypyUrls.html" +download_with_retries $uri "/tmp" "pypyUrls.html" compressed pypyVersions="$(cat /tmp/pypyUrls.html | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}')" toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json"