build script: Fix message on failed download (fixes #456) (#457)

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.
This commit is contained in:
Mariusz 2016-09-15 21:50:29 +02:00 committed by Fredrik Fornwall
parent c842d781b6
commit 6ad2991cb1
1 changed files with 3 additions and 2 deletions

View File

@ -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