`version.sh` used to return only the hash of the last commit, causing VERSION_MAJOR to possibly contain non-numeric junk.
15 lines
382 B
Bash
Executable File
15 lines
382 B
Bash
Executable File
#!/bin/sh
|
|
|
|
[ -z "${VERSION}" ] && VERSION=`git describe --tags --always 2>/dev/null | \
|
|
fgrep .` \
|
|
&& VERSION=${VERSION#v}
|
|
|
|
[ -z "${VERSION}" ] && VERSION=`cat VERSION 2>/dev/null`
|
|
|
|
[ -z "${VERSION}" ] && VERSION=0.0.0
|
|
|
|
[ "$1" = "major" ] && printf ${VERSION%%.*} \
|
|
&& exit 0
|
|
|
|
printf ${VERSION} | tee VERSION
|