#!/bin/sh

ECFS_DIR="ecryptfs-utils-git"
if test "x$1" == "x"; then
    VERSION="VERSION"
else
    VERSION=$1
fi
ECFS_WORKING_DIR="ecryptfs-utils-$VERSION"
ECFS_TAR="$ECFS_WORKING_DIR.tar.bz2"
echo "Building tarball of [${ECFS_DIR}]; writing tarball [$ECFS_TAR]"
cp -R $ECFS_DIR $ECFS_WORKING_DIR
cd $ECFS_WORKING_DIR
aclocal
autoconf
automake --add-missing
make clean
scripts/delete-cruft.sh
rm -rf scripts/
cd ..
tar cjvf $ECFS_TAR $ECFS_WORKING_DIR
rm -rf $ECFS_WORKING_DIR
