summaryrefslogtreecommitdiffstats
path: root/modules/download.inc
blob: 1b5d67cf5d750fb40f6a4ce20fc873854570342b (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..3} ""; do
		if download --retry-max-time 12 "$@"; then
			return 0
		fi
		if [ -n "$delay" ]; then
			sleep "$delay"
		fi
	done
	return 1
}