From 387fdf000ff1c281dd55e312fca747c81e1f844e Mon Sep 17 00:00:00 2001 From: Quentin Armitage Date: Sun, 16 Jan 2022 18:21:13 +0000 Subject: [PATCH] snap: Fix detecting git commit version when a release version Signed-off-by: Quentin Armitage --- snap/snapcraft.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 18c620df57..b874d63fb6 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -63,10 +63,12 @@ parts: - --disable-systemd override-build: | snapcraftctl build + VER= if [ -f lib/git-commit.h ]; then - VER=$(grep GIT_COMMIT lib/git-commit.h | cut -d'"' -f2) - else - VER= + COMMIT=`grep GIT_COMMIT lib/git-commit.h | wc -l || true` + if [ $COMMIT -eq 1 ]; then + VER=$(grep GIT_COMMIT lib/git-commit.h | cut -d'"' -f2) + fi fi if [ -z $VER ]; then VER=`grep "^AC_INIT" configure.ac | tr '[' ']' | cut -d']' -f4`