1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!/bin/sh
#
# Generate a version string for use when building.
#
# * If in a git repository use "git describe"
# * If building from tarball extract the version from the directory name or
# try to get the version fronm the packaging.
generate_version_string_from_dir() {
basename $(pwd) | grep -e '^munin-c' | cut -c9-
}
generate_version_string_from_packaging() {
if [ -d debian ]; then
dpkg-parsechangelog -SVersion 2> /dev/null
fi
}
if [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then
git describe --always
elif [ ! -z "$(generate_version_string_from_dir)" ]; then
generate_version_string_from_dir
elif [ ! -z "$(generate_version_string_from_packaging)" ]; then
generate_version_string_from_packaging
else
echo "unknown"
fi
|