aboutsummaryrefslogtreecommitdiff
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
parentc5e203bf6aa5f0dd86e3214e6ed7fa854751ed3a (diff)
downloadgnunet-9c187aa020cab67ccafba03b6907c3913573487c.tar.gz
gnunet-9c187aa020cab67ccafba03b6907c3913573487c.zip
-fallback to .version file outside of git
-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 @@
1#!/bin/bash 1#!/bin/bash
2VERSION=$(git describe --tags) 2# Gets the version number from git, or from the contents of .version
3VERSION=${VERSION:1:${#VERSION}} 3VERSION=
4echo $VERSION > .version 4if test -f ".version"
5echo -n $VERSION 5then
6 VERSION=$(cat .version)
7fi
8if test "x$VERSION" = "x" -a -d "./.git"
9then
10 VERSION=$(git describe --tags)
11 VERSION=${VERSION:1:${#VERSION}}
12 echo $VERSION > .version
13fi
14if test "x$VERSION" = "x"
15then
16 VERSION="unknown"
17fi
18echo -n "$VERSION"