Skip to content

Commit

Permalink
Skip asking github for latest hash, if we're requesting a specific hash
Browse files Browse the repository at this point in the history
Means one less call to curl in that scenario
  • Loading branch information
lurch committed Aug 2, 2016
1 parent b19779b commit e83878e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions rpi-update
Expand Up @@ -376,16 +376,16 @@ command -v readelf >/dev/null 2>&1 || {
exit 1
}

# ask github for latest version hash
REPO_API=${REPO_URI/github.com/api.github.com\/repos}/git/refs/heads/${BRANCH}
GITREV=$(curl -Ls ${REPO_API} | awk '{ if ($1 == "\"sha\":") { print substr($2, 2, 40) } }')
FW_REV=${FW_REV:-${GITREV}}

if [[ "${FW_REV}" == "" ]]; then
echo " *** No hash received from github: ${REPO_API}"
# run again with errors not suppressed
curl -L ${REPO_API}
exit 1
# ask github for latest version hash
REPO_API=${REPO_URI/github.com/api.github.com\/repos}/git/refs/heads/${BRANCH}
FW_REV=$(curl -Ls ${REPO_API} | awk '{ if ($1 == "\"sha\":") { print substr($2, 2, 40) } }')
if [[ "${FW_REV}" == "" ]]; then
echo " *** No hash received from github: ${REPO_API}"
# run again with errors not suppressed
curl -L ${REPO_API}
exit 1
fi
fi

if [[ ! -f "${FW_REVFILE}" ]]; then
Expand Down

0 comments on commit e83878e

Please sign in to comment.