From e83878eeaeb437aa5c6f2744879db3702daf47e8 Mon Sep 17 00:00:00 2001 From: Andrew Scheller Date: Thu, 30 Jun 2016 10:50:53 +0100 Subject: [PATCH] Skip asking github for latest hash, if we're requesting a specific hash Means one less call to curl in that scenario --- rpi-update | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rpi-update b/rpi-update index d47e00c..5d17090 100755 --- a/rpi-update +++ b/rpi-update @@ -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