From 143fbdb2400e366388776b6590d6785d80042741 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20K=C3=B6cher?= Date: Thu, 10 Sep 2015 10:54:16 +0200 Subject: [PATCH] Issue #4 : tests if curl is available on the system; if not, wget is used in any case --- candi.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/candi.sh b/candi.sh index 766d33d..573477c 100755 --- a/candi.sh +++ b/candi.sh @@ -34,6 +34,12 @@ else DATE_CMD=$(which date) fi +if builtin command -v curl > /dev/null; then + CURL_DOWNLOADER_AVAILABLE=true +else + CURL_DOWNLOADER_AVAILABLE=false +fi + # Start global timer TIC_GLOBAL="$(${DATE_CMD} +%s%N)" @@ -83,7 +89,7 @@ package_fetch () { if [ ${PACKING} = ".tar.bz2" ] || [ ${PACKING} = ".tar.gz" ] || [ ${PACKING} = ".tbz2" ] || [ ${PACKING} = ".tgz" ] || [ ${PACKING} = ".tar.xz" ] || [ ${PACKING} = ".zip" ]; then # Only download archives that do not exist if [ ! -e ${NAME}${PACKING} ]; then - if [ ${DOWNLOADER} = "curl" ]; then + if [ ${DOWNLOADER} = "curl" ] && [${CURL_DOWNLOADER_AVAILABLE} = "true" ] ; then curl -O ${SOURCE}${NAME}${PACKING} else if [ ${STABLE_BUILD} = false ] && [ ${USE_SNAPSHOTS} = true ]; then -- 2.39.5