File: get_version

package info (click to toggle)
kbtin 2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,856 kB
  • sloc: ansic: 18,627; perl: 179; sh: 88; makefile: 17
file content (10 lines) | stat: -rwxr-xr-x 281 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
#!/bin/sh

v=`git describe 2>/dev/null`
test -n "$v" || v=`cat VERSION` || v=UNKNOWN
[ "$v" = '$Format:%(describe)$' ] && 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}"