#!/bin/sh

# This script is used after exporting the CVS to build a new
# release tarball

set -e

find -name .cvsignore -print0 | xargs -0 rm
version=`grep 'VERSION =' pingd | sed -e "s/.* '//" -e "s/'.*//"`
dirname=`basename \`pwd\``
pod2man --section=1 --release="$version" --center=Echolot pingd doc/pingd.1
pod2man --section=5 --release="$version" --center=Echolot doc/pingd.conf.pod doc/pingd.conf.5

if [ "$dirname" != "echolot-$version" ] ; then
	echo "WARN: Version $version might be wrong"
	echo "Enter to continue"
	read
fi

cd ..
tar czf $dirname.tar.gz $dirname
gpg --detach-sign $dirname.tar.gz