summaryrefslogtreecommitdiffstats
path: root/modules/download.inc
blob: c1b0912bc5a404be6d178e38de7e9a1b311dafe4 (plain) (blame)
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
}