mirror of
https://github.com/rbenv/ruby-build.git
synced 2025-09-06 17:21:21 +02:00
use wget
if it's available and curl isn't
This commit is contained in:
parent
cacc406e04
commit
46d7a6d7f9
1 changed files with 9 additions and 1 deletions
|
@ -89,12 +89,20 @@ make_package() {
|
|||
popd >&4
|
||||
}
|
||||
|
||||
if type curl &>/dev/null; then
|
||||
get() { curl "$@" ;}
|
||||
elif type wget &>/dev/null; then
|
||||
get() { wget -O- "$@" ;}
|
||||
else
|
||||
get() { echo "curl or wget is required" >&2; exit 1 ;}
|
||||
fi
|
||||
|
||||
fetch_tarball() {
|
||||
local package_name="$1"
|
||||
local package_url="$2"
|
||||
|
||||
echo "Downloading ${package_url}..." >&2
|
||||
{ curl "$package_url" > "${package_name}.tar.gz"
|
||||
{ get "$package_url" > "${package_name}.tar.gz"
|
||||
tar xzvf "${package_name}.tar.gz"
|
||||
} >&4 2>&1
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue