From 81333051b5af82aeff36de1053fb660104364c1e Mon Sep 17 00:00:00 2001
From: Daniel Gibbs <me@danielgibbs.co.uk>
Date: Sat, 2 Jul 2016 19:44:37 +0100
Subject: [PATCH] Added curl checking

---
 lgsm/functions/command_update_functions.sh | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/lgsm/functions/command_update_functions.sh b/lgsm/functions/command_update_functions.sh
index e8d423b2f..f7f1fc2d7 100644
--- a/lgsm/functions/command_update_functions.sh
+++ b/lgsm/functions/command_update_functions.sh
@@ -23,7 +23,14 @@ fi
 
 if [ -n "${functionsdir}" ]; then
 	if [ -d "${functionsdir}" ]; then
-
+		# Check curl exists and use available path
+		curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+		for curlcmd in ${curlpaths}
+		do
+			if [ -x "${curlcmd}" ]; then
+				break
+			fi
+		done
 		cd "${functionsdir}"
 		for functionfile in *
 		do
@@ -33,7 +40,8 @@ if [ -n "${functionsdir}" ]; then
 				${curlcmd} -s --fail "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}"
 				local exitcode=$?
 				if [ "${exitcode}" != "0" ]; then
-					echo -ne "   checking ${functionfile}...FAIL"
+					echo -ne "   checking ${functionfile}...\c"
+					fn_print_fail_eol_nl
 					rm -rfv "${functionsdir}/${functionfile}"
 				else
 					echo -ne "   checking ${functionfile}...UPDATE"
@@ -41,7 +49,8 @@ if [ -n "${functionsdir}" ]; then
 					fn_update_function
 				fi
 			else
-				echo -ne "   checking ${functionfile}...OK"
+				echo -ne "   checking ${functionfile}...\c"
+				fn_print_fail_eol_nl
 			fi
 		done
 	fi