-#!/bin/sh
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
-DEFAULT_VERSION=2.10.51
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# LUSTRE-VERSION-GEN
+#
+# Return lustre version string
+#
+
+DEFAULT_VERSION=2.15.91
LVF=LUSTRE-VERSION-FILE
LF='
'
if test -d ${GIT_DIR:-.git} -o -f .git &&
- VN=$(git describe --match "[0-9]*" --abbrev=7 HEAD 2>/dev/null) &&
- case "$VN" in
- *$LF*) (exit 1) ;;
- [0-9]*)
- git update-index -q --refresh
- test -z "$(git diff-index --name-only HEAD --)" ||
- VN="$VN-dirty" ;;
- esac
+ VN=$(git describe --match "[0-9]*" --abbrev=7 HEAD 2>/dev/null) &&
+ case "$VN" in
+ *$LF*) (exit 1) ;;
+ [0-9]*)
+ git update-index -q --refresh
+ test -z "$(git diff-index --name-only HEAD --)" ||
+ VN="$VN-dirty" ;;
+ esac
then
- VN=$(echo "$VN" | sed -e 's/-/_/g');
+ VN=$(echo "$VN" | sed -e 's/-/_/g');
elif test -r $LVF
then
- VN=$(sed -e 's/^LUSTRE_VERSION = //' <$LVF)
+ VN=$(sed -e 's/^LUSTRE_VERSION = //' <$LVF)
else
- VN="$DEFAULT_VERSION"
+ VN="$DEFAULT_VERSION"
fi
if test -r $LVF
then
- VC=$(sed -e 's/^LUSTRE_VERSION = //' <$LVF)
+ VC=$(sed -e 's/^LUSTRE_VERSION = //' <$LVF)
else
- VC=unset
+ VC=unset
fi
test "$VN" = "$VC" || {
- echo "LUSTRE_VERSION = $VN" >$LVF
+ echo "LUSTRE_VERSION = $VN" >$LVF
}
echo $VN