chiark / gitweb /
build script: Fix message on failed download (fixes #456) (#457)
authorMariusz <DEVoytas@gmail.com>
Thu, 15 Sep 2016 19:50:29 +0000 (21:50 +0200)
committerFredrik Fornwall <fredrik@fornwall.net>
Thu, 15 Sep 2016 19:50:29 +0000 (21:50 +0200)
Message displayed when file download fails, shows wrong information
about maximum number of attempts. Hardcoded value of '3' is shown,
but in reality there is up to six attempts (when subsequent downloads
keep failing).
Fix it by using correct value.

build-package.sh

index 4e52fd9aba3fa8c767aa629d93cf7eb49b51c7bc..539ec5b46bebbb3dad3e38798d71037057dd125e 100755 (executable)
@@ -161,7 +161,8 @@ termux_download() {
 
        TMPFILE=`mktemp $TERMUX_PKG_TMPDIR/download.$TERMUX_PKG_NAME.XXXXXXXXX`
        echo "Downloading ${URL}"
-       for i in 1 2 3 4 5 6; do
+       TRYMAX=6
+       for try in $(seq 1 $TRYMAX); do
                if curl -L --fail --retry 2 -o "$TMPFILE" "$URL"; then
                        if [ $# = 3 ]; then
                                # Optional checksum argument:
@@ -173,7 +174,7 @@ termux_download() {
                        mv "$TMPFILE" "$DESTINATION"
                        return
                else
-                       echo "Download of $1 failed (attempt $i/3)" 1>&2
+                       echo "Download of $1 failed (attempt $try/$TRYMAX)" 1>&2
                        sleep 45
                fi
        done