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".
This commit is contained in:
Will Kahn-Greene 2011-07-27 15:16:42 -07:00
parent a7e23c4863
commit 24c5c586df

View File

@ -1,29 +1,31 @@
#!/bin/bash #!/bin/bash
# usage: maketarball # usage: maketarball [-d] <rev-ish>
# maketarball <tag>
# #
# With no arguments, this creates a source tarball from git master with a # Creates a tarball from a rev-ish. If -d is passed in, then it adds
# filename based on today's date. # the date to the directory name.
#
# With a <tag> argument, this creates a tarball of the tag.
# #
# Examples: # Examples:
# #
# ./maketarball # ./maketarball -d master
# ./maketarball v0.0.2 # ./maketarball v0.0.2
if [[ -z "$1" ]]; then
echo "Usage: ./maketarball [-d] <rev-ish>";
exit 1;
fi
NOWDATE=`date "+%Y-%m-%d"` NOWDATE=`date "+%Y-%m-%d"`
if [ -z "$1" ] if [[ $@ == *-d* ]]; then
then REVISH=$2
REVISH=master
PREFIX="$NOWDATE-$REVISH" PREFIX="$NOWDATE-$REVISH"
else else
REVISH=$1 REVISH=$1
PREFIX="$REVISH" PREFIX="$REVISH"
fi fi
# convert PREFIX to all lowercase. # convert PREFIX to all lowercase.
# nix the v from tag names. # nix the v from tag names.
PREFIX=`echo "$PREFIX" | tr '[A-Z]' '[a-z]' | sed s/v//` 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 "archive at mediagoblin-$PREFIX.tar.gz"
echo "done." echo "done."