From 24ade5322fa268e6b2aed6012911f1f320112e72 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Fri, 14 Sep 2018 00:01:30 -0600 Subject: [PATCH] Check if curl installed --- cfddns.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cfddns.sh b/cfddns.sh index 5e594d8..0d57162 100755 --- a/cfddns.sh +++ b/cfddns.sh @@ -129,6 +129,7 @@ ip6=0 ## define error code explainations errorExplain[1]="Missing or invalid parameters on script invocation." +errorExplain[2]="curl is required to access CloudFlare API. Please install curl. (apt-get install curl on debian/ubuntu)." errorExplain[101]="Location of file with CloudFlare account details was NOT provided (-f parameter missing)." errorExplain[102]="CloudFlare account details file is empty or does not exist" errorExplain[103]="No DNS records to update were specified (-r parameter(s) missing)." @@ -203,6 +204,13 @@ elif [ -z ${dnsRecords} ]; then quit 103 fi +# Check if curl is installed +command -v curl +curlResult=$(echo "$?") +if [ $curlResult -ne 0 ]; then + quit 2 +fi + # Log operating mode if [ $ip4 -eq 1 ]; then echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`] Script running in" \