summaryrefslogtreecommitdiffstats
path: root/version.sh
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-08-09 10:07:23 +0200
committerwm4 <wm4@nowhere>2013-08-09 10:07:23 +0200
commitc6db8f6a8bea199910b8ca4d381621e9ca581821 (patch)
tree65e25866439fadf4f9d2849e60f97d84b9aa13fa /version.sh
parentb27f65a758a10e6a4742e44644c719786b999126 (diff)
downloadmpv-c6db8f6a8bea199910b8ca4d381621e9ca581821.tar.bz2
mpv-c6db8f6a8bea199910b8ca4d381621e9ca581821.tar.xz
version.sh: add --print option, which prints version to stdout
Might be helpful when creating a tarball.
Diffstat (limited to 'version.sh')
-rwxr-xr-xversion.sh25
1 files 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)\""