From d6b777875361aa2f18a3f75f56fe109e38832211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 5 Oct 2014 09:51:57 +0200 Subject: [PATCH] fetchurl: fix mirroring after ecf5a08831f18e3ae2fc857c70d60fc11f622dd6 --- pkgs/build-support/fetchurl/builder.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkgs/build-support/fetchurl/builder.sh b/pkgs/build-support/fetchurl/builder.sh index 48881bdb2844..8a0c6f94a40d 100644 --- a/pkgs/build-support/fetchurl/builder.sh +++ b/pkgs/build-support/fetchurl/builder.sh @@ -27,16 +27,17 @@ tryDownload() { header "trying $url" local curlexit=18; + success= + # if we get error code 18, resume partial download while [ $curlexit -eq 18 ]; do - $curl -C - --fail "$url" --output "$downloadedFile" - local curlexit=$?; + # keep this inside an if statement, since on failure it doesn't abort the script + if $curl -C - --fail "$url" --output "$downloadedFile"; then + success=1 + else + curlexit=$?; + fi done - - success= - if [ $curlexit -eq 0 ]; then - success=1 - fi stopNest }