linuxcnc/scripts/version-is-release
Sebastian Kuzminsky 0e967d353d build system: make the git scripts more user friendly
Git can tell you what the root dir of the repo is, so the scripts don't
need to force the user to cd there first.

Signed-off-by: Sebastian Kuzminsky <seb@highlab.com>
2015-09-16 09:09:48 -06:00

34 lines
769 B
Bash
Executable file

#!/bin/bash
#
# This script checks if the current version (HEAD) is an official release.
# If so, the program returns with an exit code of 0 (True). If it is not a
# release, the program returns an exit code other than 0 (False).
#
# HEAD is an official release if there exists a tag that points to it and
# that is signed by the release manager's key.
#
if [ ! -z "$EMC2_HOME" ]; then
source $EMC2_HOME/scripts/githelper.sh
else
source $(git rev-parse --show-toplevel)/scripts/githelper.sh
fi
githelper $1
if [ -z "$GIT_TAG" ]; then
# no signed tags found
echo "no"
exit 1
fi
TAGGED_REV=$(git rev-parse $GIT_TAG^{commit})
HEAD_REV=$(git rev-parse HEAD)
if [ "$TAGGED_REV" == "$HEAD_REV" ]; then
echo "yes"
exit 0
fi
echo "no"
exit 1