summaryrefslogtreecommitdiffstats
path: root/scripts/add-version-to-appdata.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/add-version-to-appdata.sh')
-rwxr-xr-xscripts/add-version-to-appdata.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/add-version-to-appdata.sh b/scripts/add-version-to-appdata.sh
index a0d8e1f5d..7d48e840a 100755
--- a/scripts/add-version-to-appdata.sh
+++ b/scripts/add-version-to-appdata.sh
@@ -1,4 +1,10 @@
-#!/bin/sh
-version=$(git describe --abbrev=12)
-date=$(git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d)
+#!/bin/bash
+#
+# work either when building from git or when building from our hand
+# crafted tar balls for OBS
+# this will, however, fail for plain tar balls create via git archive
+
+SCRIPT_DIR="$( cd "${BASH_SOURCE%/*}" ; pwd )"
+version=$(git describe --abbrev=12) || version=$(cat "$SCRIPT_DIR"/../.gitversion)
+date=$(git log -1 --format="%ct" | xargs -I{} date -d @{} +%Y-%m-%d) || date=$(cat "$SCRIPT_DIR"/../.gitdate)
sed -e "s|<release version=\"\" date=\"\" />|<release version=\"$version\" date=\"$date\" />|" appdata/subsurface.appdata.xml.in > appdata/subsurface.appdata.xml