File buildtarball.sh of Package chwala

#!/bin/bash

set -e

VERSION=0.5.14
GIT_REF=master
NAME=chwala-$VERSION

ROOT_DIR=$(pwd)

rm -Rf /tmp/$NAME
mkdir /tmp/$NAME
cd /tmp/$NAME

rm -f $NAME.tar.gz
[ -d "$NAME" ] && rm -rf "$NAME"
git clone --branch master ssh://git@git.kolab.org/diffusion/rC/chwala.git $NAME
pushd $NAME
git reset --hard $GIT_REF
git archive --prefix=$NAME/ -o "$ROOT_DIR/$NAME.tar.gz" HEAD

cd "$PWD"