From 9c187aa020cab67ccafba03b6907c3913573487c Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sat, 9 Oct 2021 15:35:08 +0200 Subject: -fallback to .version file outside of git --- contrib/get_version.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/contrib/get_version.sh b/contrib/get_version.sh index b57f3524f..35eed9f94 100755 --- a/contrib/get_version.sh +++ b/contrib/get_version.sh @@ -1,5 +1,18 @@ #!/bin/bash -VERSION=$(git describe --tags) -VERSION=${VERSION:1:${#VERSION}} -echo $VERSION > .version -echo -n $VERSION +# Gets the version number from git, or from the contents of .version +VERSION= +if test -f ".version" +then + VERSION=$(cat .version) +fi +if test "x$VERSION" = "x" -a -d "./.git" +then + VERSION=$(git describe --tags) + VERSION=${VERSION:1:${#VERSION}} + echo $VERSION > .version +fi +if test "x$VERSION" = "x" +then + VERSION="unknown" +fi +echo -n "$VERSION" -- cgit v1.2.3