Commit acabe1fa by Stéphane Graber

download: Have wget retry 3 times

This forces wget to retry if it gets a network error. Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent c00f3f36
...@@ -69,9 +69,19 @@ cleanup() { ...@@ -69,9 +69,19 @@ cleanup() {
fi fi
} }
wget_wrapper() {
for i in $(seq 3); do
if wget $@; then
return 0
fi
done
return 1
}
download_file() { download_file() {
if ! wget -T 30 -q https://${DOWNLOAD_SERVER}/$1 -O $2 >/dev/null 2>&1; then if ! wget_wrapper -T 30 -q https://${DOWNLOAD_SERVER}/$1 -O $2 >/dev/null 2>&1; then
if ! wget -T 30 -q http://${DOWNLOAD_SERVER}/$1 -O $2 >/dev/null 2>&1; then if ! wget_wrapper -T 30 -q http://${DOWNLOAD_SERVER}/$1 -O $2 >/dev/null 2>&1; then
if [ "$3" = "noexit" ]; then if [ "$3" = "noexit" ]; then
return 1 return 1
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment