]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix #1497 - Added error checking if 'git describe --dirty' is not supported by the...
authorDenis Pellizzon <denispellizzon@libero.it>
Thu, 6 Dec 2012 20:48:58 +0000 (21:48 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Sun, 6 Jan 2013 20:28:44 +0000 (20:28 +0000)
support/version

index 8f74a65bfa26c565afe919eb62ef7554cfbceb64..e767cb620fa48b7559468f060571ea973614bd54 100755 (executable)
@@ -8,7 +8,13 @@ FILE=$1
 
 # Calculate version
 if [ -d ".git" ]; then
-    VER=$(cd $(dirname $0); git describe --dirty --match "v*" 2> /dev/null | sed "s/^v//" | sed "s/-\([0-9]*\)-\(g[0-9a-f]*\)/.\1~\2/")
+    VER=$(cd $(dirname $0); git describe --dirty --match "v*" 2> /dev/null)
+    if [ $? -ne 0 ]; then
+        # Git describe failed, maybe "--dirty" option is not available
+        # Adding "--UNKNOWN" postfix to mark this situation
+        VER=$(cd $(dirname $0); git describe --match "v*" 2> /dev/null)--UNKNOWN
+    fi
+    VER=$(echo $VER | sed "s/^v//" | sed "s/-\([0-9]*\)-\(g[0-9a-f]*\)/.\1~\2/")
 else
     VER=$(head -1 $(dirname $0)/../debian/changelog | awk '{ print $2 }' | tr -d '()' | cut -d '-' -f 1)
 fi