Skip to content
This repository was archived by the owner on Nov 6, 2018. It is now read-only.

Commit 185877f

Browse files
committed
Ensure fallback to curl after failed wget
1 parent 8380b4a commit 185877f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

build.sh

+8-5
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,19 @@ __get_remote_file() {
9999
return 0
100100
fi
101101

102-
local succeeded=false
102+
local failed=false
103103
if __machine_has wget; then
104-
wget --tries 10 --quiet -O "$local_path" "$remote_path" && succeeded=true
104+
wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true
105+
else
106+
failed=true
105107
fi
106108

107-
if [ "$succeeded" = false ] && __machine_has curl; then
108-
curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" && succeeded=true
109+
if [ "$failed" = true ] && __machine_has curl; then
110+
failed=false
111+
curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true
109112
fi
110113

111-
if [ "$succeeded" = false ]; then
114+
if [ "$failed" = true ]; then
112115
__error "Download failed: $remote_path" 1>&2
113116
return 1
114117
fi

0 commit comments

Comments
 (0)