Improve curl with retry on error

Improve curl with retry on error

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
This commit is contained in:
Bensuperpc 2021-08-06 01:17:47 +02:00
parent 77da067e8e
commit 501b1b84dc
7 changed files with 59 additions and 9 deletions

View File

@ -29,7 +29,13 @@ function build_curl {
local curl_sha256=$2 local curl_sha256=$2
check_var ${curl_sha256} check_var ${curl_sha256}
check_var ${CURL_DOWNLOAD_URL} check_var ${CURL_DOWNLOAD_URL}
curl -fsSLO ${CURL_DOWNLOAD_URL}/${curl_fname}.tar.gz curl --connect-timeout 30 \
--max-time 10 \
--retry 5 \
--retry-delay 10 \
--retry-max-time 30 \
-fsSLO ${CURL_DOWNLOAD_URL}/${curl_fname}.tar.gz
check_sha256sum ${curl_fname}.tar.gz ${curl_sha256} check_sha256sum ${curl_fname}.tar.gz ${curl_sha256}
tar -zxf ${curl_fname}.tar.gz tar -zxf ${curl_fname}.tar.gz
(cd curl-*/ && do_curl_build) (cd curl-*/ && do_curl_build)

View File

@ -25,7 +25,12 @@ cd /usr/src
url="https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz" url="https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz"
echo "Downloading $url" echo "Downloading $url"
curl -# -LO $url curl --connect-timeout 20 \
--max-time 10 \
--retry 5 \
--retry-delay 10 \
--retry-max-time 40 \
-# -LO $url
tar xvzf git-${GIT_VERSION}.tar.gz --no-same-owner tar xvzf git-${GIT_VERSION}.tar.gz --no-same-owner
rm -f git-${GIT_VERSION}.tar.gz rm -f git-${GIT_VERSION}.tar.gz

View File

@ -27,7 +27,13 @@ done
# Download # Download
REV=v1.10.2 REV=v1.10.2
curl -# -o ninja.tar.gz -LO https://github.com/ninja-build/ninja/archive/$REV.tar.gz curl --connect-timeout 30 \
--max-time 10 \
--retry 5 \
--retry-delay 10 \
--retry-max-time 30 \
-# -o ninja.tar.gz -LO https://github.com/ninja-build/ninja/archive/$REV.tar.gz
mkdir ninja mkdir ninja
tar -xzvf ./ninja.tar.gz --strip-components=1 -C ./ninja tar -xzvf ./ninja.tar.gz --strip-components=1 -C ./ninja

View File

@ -5,7 +5,13 @@ set -ex
OPENSSH_ROOT=V_8_5_P1 OPENSSH_ROOT=V_8_5_P1
cd /usr/src cd /usr/src
curl -LO https://github.com/openssh/openssh-portable/archive/${OPENSSH_ROOT}.tar.gz curl --connect-timeout 20 \
--max-time 10 \
--retry 5 \
--retry-delay 10 \
--retry-max-time 40 \
-LO https://github.com/openssh/openssh-portable/archive/${OPENSSH_ROOT}.tar.gz
tar -xvf ${OPENSSH_ROOT}.tar.gz tar -xvf ${OPENSSH_ROOT}.tar.gz
rm -f ${OPENSSH_ROOT}.tar.gz rm -f ${OPENSSH_ROOT}.tar.gz

View File

@ -69,7 +69,13 @@ function build_perl {
local perl_sha256=$2 local perl_sha256=$2
check_var ${perl_sha256} check_var ${perl_sha256}
check_var ${PERL_DOWNLOAD_URL} check_var ${PERL_DOWNLOAD_URL}
curl -fsSLO ${PERL_DOWNLOAD_URL}/${perl_fname}.tar.gz curl --connect-timeout 30 \
--max-time 10 \
--retry 5 \
--retry-delay 10 \
--retry-max-time 30 \
-fsSLO ${PERL_DOWNLOAD_URL}/${perl_fname}.tar.gz
check_sha256sum ${perl_fname}.tar.gz ${perl_sha256} check_sha256sum ${perl_fname}.tar.gz ${perl_sha256}
tar -xzf ${perl_fname}.tar.gz tar -xzf ${perl_fname}.tar.gz
(cd ${perl_fname} && do_perl_build) (cd ${perl_fname} && do_perl_build)
@ -88,7 +94,13 @@ function build_openssl {
local openssl_sha256=$2 local openssl_sha256=$2
check_var ${openssl_sha256} check_var ${openssl_sha256}
check_var ${OPENSSL_DOWNLOAD_URL} check_var ${OPENSSL_DOWNLOAD_URL}
curl -fsSLO ${OPENSSL_DOWNLOAD_URL}/${openssl_fname}.tar.gz curl --connect-timeout 30 \
--max-time 10 \
--retry 5 \
--retry-delay 10 \
--retry-max-time 30 \
-fsSLO ${OPENSSL_DOWNLOAD_URL}/${openssl_fname}.tar.gz
check_sha256sum ${openssl_fname}.tar.gz ${openssl_sha256} check_sha256sum ${openssl_fname}.tar.gz ${openssl_sha256}
tar -xzf ${openssl_fname}.tar.gz tar -xzf ${openssl_fname}.tar.gz
(cd ${openssl_fname} && PATH=/opt/perl/bin:${PATH} do_openssl_build) (cd ${openssl_fname} && PATH=/opt/perl/bin:${PATH} do_openssl_build)

View File

@ -38,7 +38,12 @@ cd /usr/src
CMAKE_ROOT=cmake-${CMAKE_VERSION}-Centos5-${ARCH} CMAKE_ROOT=cmake-${CMAKE_VERSION}-Centos5-${ARCH}
url=https://github.com/dockbuild/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_ROOT}.tar.gz url=https://github.com/dockbuild/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_ROOT}.tar.gz
echo "Downloading $url" echo "Downloading $url"
curl -# -LO $url curl --connect-timeout 30 \
--max-time 10 \
--retry 5 \
--retry-delay 10 \
--retry-max-time 30 \
-# -LO $url
tar -xzvf ${CMAKE_ROOT}.tar.gz tar -xzvf ${CMAKE_ROOT}.tar.gz
rm -f ${CMAKE_ROOT}.tar.gz rm -f ${CMAKE_ROOT}.tar.gz

View File

@ -26,10 +26,20 @@ gpg --keyserver hkp://pgp.key-server.io:80 --recv-keys B42F6819007F00F88E364FD40
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
echo "Downloading $url" echo "Downloading $url"
curl -o /usr/local/bin/gosu -# -SL $url curl --connect-timeout 30 \
--max-time 10 \
--retry 5 \
--retry-delay 10 \
--retry-max-time 30 \
-o /usr/local/bin/gosu -# -SL $url
echo "Downloading $url_key" echo "Downloading $url_key"
curl -o /usr/local/bin/gosu.asc -# -SL $url_key curl --connect-timeout 30 \
--max-time 10 \
--retry 5 \
--retry-delay 10 \
--retry-max-time 30 \
-o /usr/local/bin/gosu.asc -# -SL $url_key
gpg --verify /usr/local/bin/gosu.asc gpg --verify /usr/local/bin/gosu.asc