File tree Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change 2
2
#
3
3
# Generate a version string for use when building.
4
4
#
5
- # * If RELEASE exists, and is non-empty, use the contents of that file.
6
- # This is in case we're building from a tarball.
5
+ # * If in a git repository use "git describe"
6
+ # * If building from tarball extract the version from the directory name or
7
+ # try to get the version fronm the packaging.
7
8
8
- if [ -s " RELEASE" ]; then
9
- cat RELEASE
9
+
10
+ generate_version_string_from_dir () {
11
+ basename $( pwd) | grep -e ' ^munin-c' | cut -c9-
12
+ }
13
+
14
+ generate_version_string_from_packaging () {
15
+ if [ -d debian ]; then
16
+ dpkg-parsechangelog -SVersion 2> /dev/null
17
+ fi
18
+ }
19
+
20
+ if [ " $( git rev-parse --is-inside-work-tree 2> /dev/null) " = " true" ]; then
21
+ git describe --always
22
+ elif [ ! -z " $( generate_version_string_from_dir) " ]; then
23
+ generate_version_string_from_dir
24
+ elif [ ! -z " $( generate_version_string_from_packaging) " ]; then
25
+ generate_version_string_from_packaging
10
26
else
11
- git describe --always
27
+ echo " unknown "
12
28
fi
29
+
You can’t perform that action at this time.
0 commit comments