dahdi-linux/build_tools/make_version

22 lines
593 B
Bash
Executable File

#!/bin/sh
if [ -f ${1}/.version ]; then
cat ${1}/.version
elif [ -d ${1}/.git ]; then
VERSION=`git describe --tags --dirty=M 2> /dev/null | sed -e "s/^v\([0-9]\)/\1/"`
if [ $? -ne 0 ]; then
MODIFIED=""
if [ "`git ls-files -m | wc -l`" != "0" ]; then
MODIFIED="M"
fi
# Some older versions of git do not support all the above
# options.
VERSION=GIT-`git rev-parse --short --verify HEAD`${MODIFIED}
fi
echo ${VERSION}
else
# Use the directory information in the absence of any other version
# information
pwd -P
fi