aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Kahn-Greene <willg@bluesock.org>2011-07-27 15:16:42 -0700
committerWill Kahn-Greene <willg@bluesock.org>2011-07-30 08:39:07 -0400
commit24c5c586dfe2ae047ca116c54b256b7d70273c62 (patch)
treeacc8493ab525555115efc448e415f01a4243ae2d
parenta7e23c4863999a996ee56917755bef5d7ae8f69f (diff)
downloadmediagoblin-24c5c586dfe2ae047ca116c54b256b7d70273c62.tar.lz
mediagoblin-24c5c586dfe2ae047ca116c54b256b7d70273c62.tar.xz
mediagoblin-24c5c586dfe2ae047ca116c54b256b7d70273c62.zip
Tweaks maketarball.sh
This tweaks maketarball.sh so that it takes a -d argument which adds the date to the filename and parent directory. Also, this changes maketarball.sh so it requires a rev-ish--no more "by default, grabs master".
-rwxr-xr-xmaketarball.sh24
1 files changed, 13 insertions, 11 deletions
diff --git a/maketarball.sh b/maketarball.sh
index 2ee78016..635ba481 100755
--- a/maketarball.sh
+++ b/maketarball.sh
@@ -1,29 +1,31 @@
#!/bin/bash
-# usage: maketarball
-# maketarball <tag>
+# usage: maketarball [-d] <rev-ish>
#
-# 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.
+# Creates a tarball from a rev-ish. If -d is passed in, then it adds
+# the date to the directory name.
#
# Examples:
#
-# ./maketarball
+# ./maketarball -d master
# ./maketarball v0.0.2
+if [[ -z "$1" ]]; then
+ echo "Usage: ./maketarball [-d] <rev-ish>";
+ exit 1;
+fi
+
NOWDATE=`date "+%Y-%m-%d"`
-if [ -z "$1" ]
-then
- REVISH=master
+if [[ $@ == *-d* ]]; then
+ REVISH=$2
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//`
@@ -54,4 +56,4 @@ gzip mediagoblin-$PREFIX.tar
echo "archive at mediagoblin-$PREFIX.tar.gz"
-echo "done." \ No newline at end of file
+echo "done."