[macOS] added curl method for param download
This commit is contained in:
parent
efda4bafef
commit
3c3623ef23
|
@ -14,10 +14,12 @@ SHA256ARGS="$(command -v sha256sum >/dev/null || echo '-a 256')"
|
|||
|
||||
WGETCMD="$(command -v wget || echo '')"
|
||||
IPFSCMD="$(command -v ipfs || echo '')"
|
||||
CURLCMD="$(command -v curl || echo '')"
|
||||
|
||||
# fetch methods can be disabled with ZC_DISABLE_SOMETHING=1
|
||||
ZC_DISABLE_WGET="${ZC_DISABLE_WGET:-}"
|
||||
ZC_DISABLE_IPFS="${ZC_DISABLE_IPFS:-}"
|
||||
ZC_DISABLE_CURL="${ZC_DISABLE_CURL:-}"
|
||||
|
||||
function fetch_wget {
|
||||
if [ -z "$WGETCMD" ] || ! [ -z "$ZC_DISABLE_WGET" ]; then
|
||||
|
@ -56,6 +58,26 @@ EOF
|
|||
ipfs get --output "$dlname" "$SPROUT_IPFS/$filename"
|
||||
}
|
||||
|
||||
function fetch_curl {
|
||||
if [ -z "$CURLCMD" ] || ! [ -z "$ZC_DISABLE_CURL" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
local filename="$1"
|
||||
local dlname="$2"
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Retrieving (curl): $SPROUT_URL/$filename
|
||||
EOF
|
||||
|
||||
curl \
|
||||
--output "$dlname" \
|
||||
-# -L -C - \
|
||||
"$SPROUT_URL/$filename"
|
||||
|
||||
}
|
||||
|
||||
function fetch_failure {
|
||||
cat >&2 <<EOF
|
||||
|
||||
|
@ -64,6 +86,7 @@ Try installing one of the following programs and make sure you're online:
|
|||
|
||||
* ipfs
|
||||
* wget
|
||||
* curl
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
|
@ -77,7 +100,7 @@ function fetch_params {
|
|||
|
||||
if ! [ -f "$output" ]
|
||||
then
|
||||
for method in wget ipfs failure; do
|
||||
for method in wget ipfs curl failure; do
|
||||
if "fetch_$method" "$filename" "$dlname"; then
|
||||
echo "Download successful!"
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue