File: get_version

package info (click to toggle)
termrec 0.19-2.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,024 kB
  • sloc: ansic: 8,435; makefile: 182; perl: 16; sh: 15
file content (10 lines) | stat: -rwxr-xr-x 259 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
#!/bin/sh

v=`git describe 2>/dev/null`
test -n "$v" || v=`cat VERSION 2>/dev/null`
test -n "$v" || v=UNKNOWN

[ ! -d .git ] || ! which git >/dev/null || { git diff-index --quiet HEAD -- || v="$v-dirty"; }

[ "$1" = "-n" ] || n='\n'
printf '%s'"$n" "${v##v}"