aboutsummaryrefslogtreecommitdiffstats
path: root/build-root/scripts/verdist
diff options
context:
space:
mode:
Diffstat (limited to 'build-root/scripts/verdist')
-rwxr-xr-xbuild-root/scripts/verdist31
1 files changed, 31 insertions, 0 deletions
diff --git a/build-root/scripts/verdist b/build-root/scripts/verdist
new file mode 100755
index 00000000000..9d1f1b5adcd
--- /dev/null
+++ b/build-root/scripts/verdist
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#
+# Add version to dist tarball.
+#
+BR=$1
+prefix=$2
+verstring=$3
+BASE=`pwd`
+
+git rev-parse 2> /dev/null
+if [ $? == 0 ]; then
+ git archive --prefix=${prefix}/ HEAD | gzip -9 > ${verstring}.tar.gz
+else
+ cd ..
+ tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz
+ cp ${verstring}.tar.gz $BASE
+ cd $BASE
+fi
+
+mkdir ${BASE}/tmp
+cd ${BASE}/tmp
+tar -xzf ${BASE}/${verstring}.tar.gz
+rm ${BASE}/${verstring}.tar.gz
+
+cp ${BR}/scripts/.version ${BASE}/tmp/${prefix}/build-root/scripts
+tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz
+mv ${verstring}.tar.gz ${BASE}
+
+cd ${BASE}
+rm -rf tmp