mirror of
https://github.com/rbenv/ruby-build.git
synced 2025-09-03 15:51:32 +02:00
Merge pull request #140 from jayferd/use-wget
use `wget` if it's available and curl isn't
This commit is contained in:
commit
16a01222d0
1 changed files with 9 additions and 1 deletions
|
@ -89,12 +89,20 @@ make_package() {
|
|||
popd >&4
|
||||
}
|
||||
|
||||
if type curl &>/dev/null; then
|
||||
fetch_url() { curl "$@" ;}
|
||||
elif type wget &>/dev/null; then
|
||||
fetch_url() { wget -O- "$@" ;}
|
||||
else
|
||||
fetch_url() { 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"
|
||||
{ fetch_url "$package_url" > "${package_name}.tar.gz"
|
||||
tar xzvf "${package_name}.tar.gz"
|
||||
} >&4 2>&1
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue