Adds tarball generation script
authorWill Kahn-Greene <willg@bluesock.org>
Tue, 5 Jul 2011 13:23:20 +0000 (09:23 -0400)
committerWill Kahn-Greene <willg@bluesock.org>
Tue, 5 Jul 2011 13:23:20 +0000 (09:23 -0400)
This just makes it easier to generate tarballs of master and
tarballs of releases.

maketarball.sh [new file with mode: 0755]

diff --git a/maketarball.sh b/maketarball.sh
new file mode 100755 (executable)
index 0000000..ef34da5
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# usage: maketarball
+#        maketarball <tag>
+#
+# With no arguments, this creates a source tarball from git master with a
+# filename based on today's date.
+#
+# With a <tag> argument, this creates a tarball of the tag.
+#
+# Examples:
+#
+#    ./maketarball
+#    ./maketarball v0.0.2
+
+NOWDATE=`date "+%Y-%m-%d"`
+
+if [ -z "$1" ]
+then
+    REVISH=master
+    PREFIX="$NOWDATE-$REVISH"
+else
+    REVISH=$1
+    PREFIX="$REVISH"
+fi
+
+# convert PREFIX to all lowercase.
+# nix the v from tag names.
+PREFIX=`echo "$PREFIX" | tr '[A-Z]' '[a-z]' | sed s/v//`
+
+echo "== REVISH $REVISH"
+echo "== PREFIX $PREFIX"
+
+echo ""
+
+echo "generating archive...."
+git archive \
+    --format=tar \
+    --prefix=mediagoblin-$PREFIX/ \
+    $REVISH > mediagoblin-$PREFIX.tar
+
+echo "compressing...."
+gzip mediagoblin-$PREFIX.tar
+
+echo "archive at mediagoblin-$PREFIX.tar.gz"
+
+echo "done."
\ No newline at end of file