File buildtarball.sh of Package kolab-syncroton

#!/bin/bash

set -e

VERSION=2.4.2
GIT_REF=master
NAME=kolab-syncroton-$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/S/syncroton.git $NAME
pushd $NAME
git reset --hard $GIT_REF
git archive --prefix=$NAME/ -o "$ROOT_DIR/$NAME.tar.gz" HEAD

cd "$PWD"