2008-07-23 16:12:13 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# determine-version -- report a useful version for releases
|
|
|
|
#
|
|
|
|
# Copyright 2008, Aron Griffis <agriffis@n01se.net>
|
|
|
|
# Copyright 2008, Oracle
|
|
|
|
# Released under the GNU GPLv2
|
2015-06-17 10:44:16 +00:00
|
|
|
|
2015-07-14 11:45:36 +00:00
|
|
|
v="v4.1.2"
|
2008-07-23 16:12:13 +00:00
|
|
|
|
2014-12-04 12:26:46 +00:00
|
|
|
opt=$1
|
2013-06-03 12:31:41 +00:00
|
|
|
|
2008-08-21 00:11:22 +00:00
|
|
|
which git &> /dev/null
|
|
|
|
if [ $? == 0 -a -d .git ]; then
|
|
|
|
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
|
|
|
|
if tag=`git describe --tags 2>/dev/null`; then
|
|
|
|
v="$tag"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Are there uncommitted changes?
|
|
|
|
git update-index --refresh --unmerged > /dev/null
|
|
|
|
if git diff-index --name-only HEAD | grep -v "^scripts/package" \
|
|
|
|
| read dummy; then
|
|
|
|
v="$v"-dirty
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-12-04 12:26:46 +00:00
|
|
|
if [ "$opt" = "--configure" ]; then
|
|
|
|
# Omit the trailing newline, so that m4_esyscmd can use the result directly.
|
2015-02-13 13:49:31 +00:00
|
|
|
echo -n "$v"
|
2014-12-09 14:58:11 +00:00
|
|
|
else
|
|
|
|
echo "$v"
|
2014-12-04 12:26:46 +00:00
|
|
|
fi
|
|
|
|
|
2014-12-09 14:58:11 +00:00
|
|
|
exit 0
|
2008-07-23 16:12:13 +00:00
|
|
|
|