summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2021-10-09 15:35:08 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2021-10-09 15:35:08 +0200
commit9c187aa020cab67ccafba03b6907c3913573487c (patch)
treec8b5dc22c9d47d40d66f583a9451be38f76f53e3 /contrib
parentc5e203bf6aa5f0dd86e3214e6ed7fa854751ed3a (diff)
-fallback to .version file outside of git
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/get_version.sh21
1 files 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"