summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-29 12:51:45 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-29 13:01:26 -0700
commit2b8043b82b99b5fc7222b5a9e43e4de6d4233184 (patch)
tree8d0fa8b62610a7f31cd60ac09647d7567f1e942e /scripts
parent0e0d6135afb626480f85135cf1c16c1701105088 (diff)
downloadsubsurface-2b8043b82b99b5fc7222b5a9e43e4de6d4233184.tar.gz
Create better version numbering for Windows
I don't think this will be a problem for the other OSs, but it needs a bit more testing, especially on the Mac. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get-version23
1 files changed, 19 insertions, 4 deletions
diff --git a/scripts/get-version b/scripts/get-version
index ba6406623..eb93a3322 100755
--- a/scripts/get-version
+++ b/scripts/get-version
@@ -29,7 +29,7 @@ case $os in
linux)
v=$v0
;;
- darwin|win)
+ darwin)
# just the dots in the version string - this way we can
# count them
IFS=.
@@ -42,15 +42,30 @@ case $os in
# do we need to add another digit?
# We know there are 1 or 2 dots in $v, so if it's just one
# or we are trying to get to 4, add one digit
- if [ $dots -eq 1 ] || [ $os = win ]; then
+ if [ $dots -eq 1 ]; then
if [ $# -gt 1 ]; then
v=$v.$2
else
v=$v.0
fi
fi
- # and if it was just one dot and we want 4, at another 0
- if [ $dots -eq 1 ] && [ $os = win ]; then
+ ;;
+ full|win)
+ # just the dots in the version string - this way we can
+ # count them
+ IFS=.
+ set -- $v0 # split $v0 using $IFS separator
+ dots=$(($# - 1)) # use positional argument count
+ # split version string using a '-' separator
+ IFS=-
+ set -- $v0
+ v=$1
+ if [ $dots -eq 1 ]; then
+ v=$v.0
+ fi
+ if [ $# -gt 1 ]; then
+ v=$v.$2
+ else
v=$v.0
fi
;;