Whamcloud - gitweb
LU-11830 lov: avoid signed vs. unsigned comparison
[fs/lustre-release.git] / LUSTRE-VERSION-GEN
1 #!/bin/sh
2
3 DEFAULT_VERSION=2.12.51
4 LVF=LUSTRE-VERSION-FILE
5
6 LF='
7 '
8
9 if test -d ${GIT_DIR:-.git} -o -f .git &&
10         VN=$(git describe --match "[0-9]*" --abbrev=7 HEAD 2>/dev/null) &&
11         case "$VN" in
12         *$LF*) (exit 1) ;;
13         [0-9]*)
14                 git update-index -q --refresh
15                 test -z "$(git diff-index --name-only HEAD --)" ||
16                 VN="$VN-dirty" ;;
17         esac
18 then
19         VN=$(echo "$VN" | sed -e 's/-/_/g');
20 elif test -r $LVF
21 then
22         VN=$(sed -e 's/^LUSTRE_VERSION = //' <$LVF)
23 else
24         VN="$DEFAULT_VERSION"
25 fi
26
27 if test -r $LVF
28 then
29         VC=$(sed -e 's/^LUSTRE_VERSION = //' <$LVF)
30 else
31         VC=unset
32 fi
33 test "$VN" = "$VC" || {
34         echo "LUSTRE_VERSION = $VN" >$LVF
35 }
36
37 echo $VN