diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-05-28 20:07:34 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-05-28 20:07:34 +0300 |
commit | cf57a8960ff8b3c53093ab0859721bc2cdb1300e (patch) | |
tree | abb44f1811ba2a2badeb21a15adf242d5a4f414b /kickstart-static64.sh | |
parent | 21a460dc16367c23604dd491553aa8fbe1c44df8 (diff) |
use wget when curl is not available
Diffstat (limited to 'kickstart-static64.sh')
-rwxr-xr-x | kickstart-static64.sh | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/kickstart-static64.sh b/kickstart-static64.sh index 3da2530aed..d85d5128d1 100755 --- a/kickstart-static64.sh +++ b/kickstart-static64.sh @@ -150,26 +150,56 @@ if [ "$(uname -s)" != "Linux" ] fatal "Static binary versions of netdata are available only for Linux, but this system is $(uname -s)" fi +curl="$(which_cmd curl)" +wget="$(which_cmd wget)" + # --------------------------------------------------------------------------------------------------------------------- +progress "Checking the latest version of static build..." + BASE='https://raw.githubusercontent.com/firehol/binary-packages/master' -progress "Checking the latest version of static build..." -LATEST="$(run curl -Ss "${BASE}/netdata-latest.gz.run")" +LATEST= +if [ ! -z "${curl}" -a -x "${curl}" ] +then + LATEST="$(run ${curl} "${BASE}/netdata-latest.gz.run")" +elif [ ! -z "${wget}" -a -x "${wget}" ] +then + LATEST="$(run ${wget} -O - "${BASE}/netdata-latest.gz.run")" +else + fatal "curl or wget are needed for this script to work." +fi if [ -z "${LATEST}" ] then fatal "Cannot find the latest static binary version of netdata." fi +# --------------------------------------------------------------------------------------------------------------------- + progress "Downloading static netdata binary: ${LATEST}" -run curl "${BASE}/${LATEST}" >"/tmp/${LATEST}" -if [ $? -ne 0 ] + +ret=1 +if [ ! -z "${curl}" -a -x "${curl}" ] +then + run ${curl} "${BASE}/${LATEST}" >"/tmp/${LATEST}" + ret=$? +elif [ ! -z "${wget}" -a -x "${wget}" ] +then + run ${wget} -O "/tmp/${LATEST}" "${BASE}/${LATEST}" + ret=$? +else + fatal "curl or wget are needed for this script to work." +fi + +if [ ${ret} -ne 0 -o ! -s "/tmp/${LATEST}" ] then fatal "Failed to download the latest static binary version of netdata." fi -progress "Executing the downloaded self-extracting archive" +# --------------------------------------------------------------------------------------------------------------------- + +progress "Installing netdata" sudo= [ "${UID}" != "0" ] && sudo="sudo" |