From 72cb59c7f5c384e13ad307b7342ad5c0f45757f7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 30 May 2017 13:35:18 +0100 Subject: [PATCH] With JUST_CHECK indicate when firmware is being downgraded --- rpi-update | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rpi-update b/rpi-update index 54b279e..22bc59e 100755 --- a/rpi-update +++ b/rpi-update @@ -415,8 +415,13 @@ else exit 0 fi if [[ ${JUST_CHECK} -ne 0 ]]; then - echo " *** Firmware update required. New commits available:" - DIFF_API=${REPO_URI/github.com/api.github.com\/repos}/compare/${LOCAL_HASH}...${FW_REV} + if $(compare_hashes ${LOCAL_HASH} lt ${FW_REV}); then + echo " *** Firmware update required. New commits available:" + DIFF_API=${REPO_URI/github.com/api.github.com\/repos}/compare/${LOCAL_HASH}...${FW_REV} + else + echo " *** Firmware downgrade requested. Commits to drop:" + DIFF_API=${REPO_URI/github.com/api.github.com\/repos}/compare/${FW_REV}...${LOCAL_HASH} + fi SEPARATOR="======================================================" eval curl -Ls ${GITHUB_AUTH_PARAM} ${DIFF_API} | awk -v SEPARATOR="${SEPARATOR}" -F\" ' { if ($2 == "commits") {commits=1} if (commits && $2 == "message") {print SEPARATOR "\nCommit: " $4} }' | sed 's/\\n\\n/\nCommit:\ /g' exit 2