From c6db8f6a8bea199910b8ca4d381621e9ca581821 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 9 Aug 2013 10:07:23 +0200 Subject: version.sh: add --print option, which prints version to stdout Might be helpful when creating a tarball. --- version.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/version.sh b/version.sh index 31e929ff1c..b905470139 100755 --- a/version.sh +++ b/version.sh @@ -2,7 +2,21 @@ export LC_ALL=C -test "$1" && extra="-$1" +for ac_option do + case "$ac_option" in + --extra=*) + extra="-$option" + ;; + --print) + print=yes + ;; + *) + echo "Unknown parameter: $option" >&2 + exit 1 + ;; + + esac +done # Extract revision number from file used by daily tarball snapshots # or from "git describe" output @@ -15,7 +29,14 @@ test $git_revision || git_revision=UNKNOWN version=$(cat VERSION 2> /dev/null) test $version || version=$git_revision -NEW_REVISION="#define VERSION \"${version}${extra}\"" +VERSION="${version}${extra}" + +if test "$print" = yes ; then + echo "$VERSION" + exit 0 +fi + +NEW_REVISION="#define VERSION \"${VERSION}\"" OLD_REVISION=$(head -n 1 version.h 2> /dev/null) BUILDDATE="#define BUILDDATE \"$(date)\"" -- cgit v1.2.3