fence-virt/utils/gen-tar
Lon Hohberger 088799e2e7 Add simple tarball / release script
Signed-off-by: Lon Hohberger <lon@users.sourceforge.net>
2009-09-17 16:24:51 -04:00

31 lines
521 B
Bash
Executable File

#!/bin/sh
if ! [ -d .git ]; then
echo "Not a git archive"
exit 1
fi
if [ -n "$1" ]; then
echo Creating a tarball with version $1
fi
_owd=`pwd`
_cwd=`basename $_owd`
_branch=`git branch | grep "^\*" | awk '{print $2}'`
_archive=$_cwd-$_branch-`date +%Y-%m-%d`.tar.gz
TMPDIR=$(mktemp -d /tmp/$_cwd-XXXXXX)
cd ..
cp -a $_cwd $TMPDIR
cd $TMPDIR
if [ -n "$1" ]; then
mv $_cwd $_cwd-$1
_cwd="$_cwd-$1"
_archive=$_cwd.tar.gz
fi
tar --exclude .git -czvf $_archive $_cwd
cd $_owd
cp $TMPDIR/$_archive .
rm -rf $TMPDIR