Check if curl installed

This commit is contained in:
Asif Bacchus 2018-09-14 00:01:30 -06:00
parent 828dea9aee
commit 24ade5322f

View File

@ -129,6 +129,7 @@ ip6=0
## define error code explainations ## define error code explainations
errorExplain[1]="Missing or invalid parameters on script invocation." 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[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[102]="CloudFlare account details file is empty or does not exist"
errorExplain[103]="No DNS records to update were specified (-r parameter(s) missing)." errorExplain[103]="No DNS records to update were specified (-r parameter(s) missing)."
@ -203,6 +204,13 @@ elif [ -z ${dnsRecords} ]; then
quit 103 quit 103
fi fi
# Check if curl is installed
command -v curl
curlResult=$(echo "$?")
if [ $curlResult -ne 0 ]; then
quit 2
fi
# Log operating mode # Log operating mode
if [ $ip4 -eq 1 ]; then if [ $ip4 -eq 1 ]; then
echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`] Script running in" \ echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`] Script running in" \