File: version.sh

package info (click to toggle)
mmh 0.4-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 4,976 kB
  • sloc: ansic: 26,132; sh: 6,871; makefile: 680; awk: 74
file content (33 lines) | stat: -rwxr-xr-x 547 bytes parent folder | download | duplicates (2)
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
30
31
32
33
#!/bin/sh
#
# version.sh -- script to create version string(s) for mmh.
#
# You can pass the top soucre directory to the script.
#

if [ -d "$1" ]
then
	cd "$1"
fi

if [ ! -f VERSION ]
then
	echo "No version file found" 1>&2
	echo "usage: $0 [mmh-sourcedir]" 1>&2
	exit 1
fi

version="`sed q VERSION`"

git_info=""

if [ -d ".git" ]; then
	current=`git log -n 1 --pretty=format:+%h HEAD`
	release=`git log -n 1 --pretty=format:+%h "mmh-$version"`
	if [ "$current" != "$release" ]
	then
		git_info="$current"
	fi
fi

echo mmh-"$version""$git_info"