snapraid/autover.sh
Andrea Mazzoleni 51f064dbbd Get the version even if no tag is present
If not tag is present, git cannot describe the commit.
In this case we want "none" version.
2016-01-05 10:59:50 +01:00

19 lines
331 B
Bash
Executable file

#!/bin/sh
#
if [ -d .git ]; then
# Get version from git tags, removing the 'v' prefix
VERSION=`git describe --match 'v*' 2>/dev/null | sed 's/^v//'`
fi
if [ -f .version ]; then
# Get version from the .version file
VERSION=`cat .version`
fi
if [ -z $VERSION ]; then
VERSION="none"
fi
printf '%s' "$VERSION"