Skip to content

Commit 46d7a6d

Browse files
author
Jay Adkisson
committed
use wget if it's available and curl isn't
1 parent cacc406 commit 46d7a6d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

bin/ruby-build

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,20 @@ make_package() {
8989
popd >&4
9090
}
9191

92+
if type curl &>/dev/null; then
93+
get() { curl "$@" ;}
94+
elif type wget &>/dev/null; then
95+
get() { wget -O- "$@" ;}
96+
else
97+
get() { echo "curl or wget is required" >&2; exit 1 ;}
98+
fi
99+
92100
fetch_tarball() {
93101
local package_name="$1"
94102
local package_url="$2"
95103

96104
echo "Downloading ${package_url}..." >&2
97-
{ curl "$package_url" > "${package_name}.tar.gz"
105+
{ get "$package_url" > "${package_name}.tar.gz"
98106
tar xzvf "${package_name}.tar.gz"
99107
} >&4 2>&1
100108
}

0 commit comments

Comments
 (0)