source: rtems/cpukit/sapi/vc-key.sh @ 6f3fb8a

5
Last change on this file since 6f3fb8a was 6f3fb8a, checked in by Chris Johns <chrisj@…>, on 11/07/17 at 05:43:11

cpukit: Add a Version API.

Provide functions to get the version string, major, minor and revision
numbers and the version control identifer that is a unique tag for
the version control system.

Update #3199.

  • Property mode set to 100755
File size: 657 bytes
Line 
1#! /bin/sh
2
3git=$(command -v git)
4
5#
6# Git command not found or not a valid git repo is a release.
7#
8vc_ident="release"
9
10if test $# -ge 1; then
11 repo=$1
12 shift
13 if test -d $repo; then
14  cwd=$(pwd)
15  cd $repo
16  if test -n ${git}; then
17   git rev-parse --git-dir > /dev/null 2>&1
18   if test $? == 0; then
19    git status > /dev/null 2>&1
20    if git diff-index --quiet HEAD --; then
21     modified=""
22    else
23     modified="-modified"
24    fi
25    vc_ident="$(git rev-parse --verify HEAD)${modified}"
26    if test $# -ge 1; then
27     if test "${vc_ident}" == "$1"; then
28      vc_ident="matches"
29     fi
30    fi
31   fi
32  fi
33  cd $cwd
34 fi
35fi
36
37echo ${vc_ident}
38
39exit 0
Note: See TracBrowser for help on using the repository browser.