Contrib: Helper scripts to receive the revision ID of the repository without running cmake. Need to be run inside the repository directory.

This commit is contained in:
leak
2010-12-31 02:55:38 +01:00
parent 4b0341c167
commit c5a143547d
2 changed files with 49 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#/bin/bash
command=$(git describe --match init --abbrev=12)
IFS="-"
cmdarray=($command)
if [ "$1" != "-id" ] && [ "$1" != "-hash" ]; then
echo "Usage: $0 <-id | -hash>"
exit
fi
if [ "${cmdarray[1]}" == "" ] || [ "${cmdarray[2]}" == "" ]; then
echo "Error: No valid revision information found"
exit 1
fi
if [ "$1" == "-id" ]; then
echo ${cmdarray[1]}
elif [ "$1" == "-hash" ]; then
echo ${cmdarray[2]:1}
fi