File: make_version

package info (click to toggle)
dahdi-firmware 2.11.1.0.20170917-1
  • links: PTS, VCS
  • area: non-free
  • in suites: bullseye, buster
  • size: 9,212 kB
  • sloc: ansic: 120,145; perl: 2,395; sh: 973; makefile: 365
file content (21 lines) | stat: -rwxr-xr-x 593 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/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