3 # Usage: get_version.sh --version|--release|--full
5 # Print lcov version or release information as provided by Git, .version
8 TOOLDIR=$(cd $(dirname $0) >/dev/null ; pwd)
9 GITVER=$(cd $TOOLDIR ; git describe --tags 2>/dev/null)
11 if [ -z "$GITVER" ] ; then
12 # Get version information from file
13 if [ -e "$TOOLDIR/../.version" ] ; then
14 source "$TOOLDIR/../.version"
17 # Get version information from git
21 if [ "${GITVER#*-}" != "$GITVER" ] ; then
23 RELEASE=${RELEASE/-/.}
28 [ -z "$VERSION" ] && VERSION="1.0"
29 [ -z "$RELEASE" ] && RELEASE="1"
30 [ -z "$FULL" ] && FULL="$VERSION"
32 [ "$1" == "--version" ] && echo -n "$VERSION"
33 [ "$1" == "--release" ] && echo -n "$RELEASE"
34 [ "$1" == "--full" ] && echo -n "$FULL"