From ee9ed7e3a69c3953f98cca007680bdb9e5f6ef27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Sat, 5 May 2018 13:17:55 +0000 Subject: [PATCH] Use full hash as version if no tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- configure.ac | 1 - version.sh | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index e448619..8dbbcee 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,6 @@ AC_INIT([glorytun], [https://github.com/angt/glorytun/issues], [glorytun], [https://github.com/angt/glorytun]) -AC_DEFINE_UNQUOTED([VERSION_MAJOR], [m4_esyscmd([./version.sh major])]) AC_CONFIG_SRCDIR([src/common.h]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/version.sh b/version.sh index 2951cb2..2b0ea3f 100755 --- a/version.sh +++ b/version.sh @@ -1,13 +1,12 @@ #!/bin/sh -[ -z "${VERSION}" ] && VERSION=`git describe --tags --match='v[0-9].*' 2>/dev/null` \ - && VERSION=${VERSION#v} +[ -z "${VERSION}" ] && VERSION="$(git describe --tags --match='v[0-9].*' 2>/dev/null)" \ + && VERSION="${VERSION#v}" -[ -z "${VERSION}" ] && VERSION=`cat VERSION 2>/dev/null` +[ -z "${VERSION}" ] && VERSION="$(git rev-parse HEAD 2>/dev/null)" -[ -z "${VERSION}" ] && VERSION=0.0.0 +[ -z "${VERSION}" ] && VERSION="$(cat VERSION 2>/dev/null)" -[ "$1" = "major" ] && printf ${VERSION%%.*} \ - && exit 0 +[ -z "${VERSION}" ] && VERSION="0.0.0" -printf ${VERSION} | tee VERSION +printf "%s" "${VERSION}" | tee VERSION