From d6dc2f7eaa02e21684c07b56475de83f7e3f4fee Mon Sep 17 00:00:00 2001 From: Jared Ballou Date: Tue, 19 Jan 2016 04:12:36 -0500 Subject: [PATCH] More hash updates --- Insurgency/insserver | 2 +- functions/github_hash.sh | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Insurgency/insserver b/Insurgency/insserver index bc942f15a..fe8af49a1 100755 --- a/Insurgency/insserver +++ b/Insurgency/insserver @@ -130,7 +130,7 @@ fn_getgithubfile(){ cmd="$fetchcmd -O" fi fetch=$($cmd "${filepath}" "${githuburl}" 2>&1) - if [ "${exec}" ]; then + if [ "${exec}" != "" ]; then chmod +x "${filepath}" fi fn_colortext 32 "DONE" diff --git a/functions/github_hash.sh b/functions/github_hash.sh index 78ca52f23..a722a6a60 100755 --- a/functions/github_hash.sh +++ b/functions/github_hash.sh @@ -30,7 +30,9 @@ fn_get_github_manifest(){ if [ ! -e "${cachedir}" ]; then mkdir -p "${cachedir}" fi - fn_getgithubfile "functions/jq-linux64" binary + fn_getgithubfile "functions/jq-linux64" + jq_path="${lgsmdir}/functions/jq-linux64" + chmod +x "${jq_path}" # Get latest commit from GitHub. Cache file for 60 minutes if [ -e $lastcommit_file ]; then if [ $(($(date +%s) - $(date -r ${lastcommit_file} +%s))) -gt 3600 ]; then @@ -44,7 +46,7 @@ fn_get_github_manifest(){ if [ $fetch -eq 1 ]; then echo "Fetching ${lastcommit_file}" curl -s "https://api.github.com/repos/${githubuser}/${githubrepo}/git/refs/heads/${githubbranch}" -o "${lastcommit_file}.json" - ${lgsmdir}/functions/jq-linux64 -r '.object.sha' "${lastcommit_file}.json" > "${lastcommit_file}" + "${jq_path}" -r '.object.sha' "${lastcommit_file}.json" > "${lastcommit_file}" fi # Get manifest of all files at this revision in GitHub. These hashes are what we use to compare and select files that need to be updated. manifest="${cachedir}/$(cat "${lastcommit_file}").manifest" @@ -52,7 +54,7 @@ fn_get_github_manifest(){ curl -Ls "https://api.github.com/repos/${githubuser}/${githubrepo}/git/trees/${githubbranch}?recursive=1" -o "${manifest}.json" fi if [ ! -e "${manifest}" ]; then - ${lgsmdir}/functions/jq-linux64 -r '.tree[] | .path + " " + .sha' "${manifest}.json" > "${manifest}" + "${jq_path}" -r '.tree[] | .path + " " + .sha' "${manifest}.json" > "${manifest}" fi }