From ef81e00a6261da9f3eda579e785a90e37161440b Mon Sep 17 00:00:00 2001 From: Thomas Dalichow <2012-02-05.github.com@thomasdalichow.de> Date: Thu, 3 Sep 2015 21:56:35 +0200 Subject: [PATCH] Fix output of commit messages - kind of This fixes unnecessary newlines and prints one commit per line. An additional prefix of "Commit: " is added to make grepping for the count of new commits possible for external scripts that take the output of rpi-update as input (I am currently writing a Nagios/Icinga check that makes it possible to monitor how many commits one is behind the chosen ${BRANCH}). That being said, I find the current way of collecting the commits ${BRANCH} master to be kind of fragile. I may fix this another time. --- rpi-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpi-update b/rpi-update index 307b930..d1ea461 100755 --- a/rpi-update +++ b/rpi-update @@ -345,7 +345,7 @@ else echo " *** Firmware update required. New commits available:" DIFF_API=${REPO_URI/github.com/api.github.com\/repos}/compare/$(cat "${FW_REVFILE}")...${BRANCH} SEPARATOR="======================================================" - curl -Ls ${DIFF_API} | awk -v SEPARATOR="${SEPARATOR}" -F\" ' { if ($2 == "commits") {commits=1} if (commits && $2 == "message") {print SEPARATOR "\n" $4} }' | sed 's/\\n/\n/g' + curl -Ls ${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 fi fi