Browse Source

Added curl checking

pull/914/head
Daniel Gibbs 9 years ago
parent
commit
81333051b5
  1. 15
      lgsm/functions/command_update_functions.sh

15
lgsm/functions/command_update_functions.sh

@ -23,7 +23,14 @@ fi
if [ -n "${functionsdir}" ]; then if [ -n "${functionsdir}" ]; then
if [ -d "${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}" cd "${functionsdir}"
for functionfile in * for functionfile in *
do do
@ -33,7 +40,8 @@ if [ -n "${functionsdir}" ]; then
${curlcmd} -s --fail "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}" ${curlcmd} -s --fail "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}"
local exitcode=$? local exitcode=$?
if [ "${exitcode}" != "0" ]; then if [ "${exitcode}" != "0" ]; then
echo -ne " checking ${functionfile}...FAIL" echo -ne " checking ${functionfile}...\c"
fn_print_fail_eol_nl
rm -rfv "${functionsdir}/${functionfile}" rm -rfv "${functionsdir}/${functionfile}"
else else
echo -ne " checking ${functionfile}...UPDATE" echo -ne " checking ${functionfile}...UPDATE"
@ -41,7 +49,8 @@ if [ -n "${functionsdir}" ]; then
fn_update_function fn_update_function
fi fi
else else
echo -ne " checking ${functionfile}...OK" echo -ne " checking ${functionfile}...\c"
fn_print_fail_eol_nl
fi fi
done done
fi fi

Loading…
Cancel
Save