File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # Usage: get_version.sh --version|--release|--full
4
+ #
5
+ # Print lcov version or release information as provided by Git, .version
6
+ # or a fallback.
7
+
8
+ TOOLDIR=$( cd $( dirname $0 ) ; pwd)
9
+ GITVER=$( cd $TOOLDIR ; git describe --tags 2> /dev/null)
10
+
11
+ if [ -z " $GITVER " ] ; then
12
+ # Get version information from file
13
+ if [ -e " $TOOLDIR /../.version" ] ; then
14
+ source " $TOOLDIR /../.version"
15
+ fi
16
+ else
17
+ # Get version information from git
18
+ FULL=${GITVER: 1}
19
+ VERSION=${GITVER%% -* }
20
+ VERSION=${VERSION: 1}
21
+ if [ " ${GITVER#* -} " != " $GITVER " ] ; then
22
+ RELEASE=${GITVER#* -}
23
+ RELEASE=${RELEASE/ -/ .}
24
+ fi
25
+ fi
26
+
27
+ # Fallback
28
+ [ -z " $VERSION " ] && VERSION=" 1.0"
29
+ [ -z " $RELEASE " ] && RELEASE=" 1"
30
+ [ -z " $FULL " ] && FULL=" $VERSION "
31
+
32
+ [ " $1 " == " --version" ] && echo -n " $VERSION "
33
+ [ " $1 " == " --release" ] && echo -n " $RELEASE "
34
+ [ " $1 " == " --full" ] && echo -n " $FULL "
You can’t perform that action at this time.
0 commit comments