1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/bin/ash download() { curl --location --max-redirs 5 --max-time 7 --connect-timeout 2 "$@" } download_retry() { for delay in 1 2 3 ""; do if download --retry-max-time 12 "$@"; then return 0 fi if [ -n "$delay" ]; then sleep "$delay" fi done return 1 }