#! /bin/sh
if [ "x$1" = "x" ]
then
	echo "Usage: $0 <release number>"
	exit 1
fi

if test -e Makefile; then
  make distclean
fi
autoconf

# Update version number and modification date in code
./update-version $1

PWDSAVE=`pwd`
PACKAGE=nagios
pushd ..
if [ ! -d $PACKAGE-$1 ]; then
  ln -s `basename $PWDSAVE` $PACKAGE-$1
fi
tar zhcvf $PACKAGE-$1.tar.gz --exclude RCS --exclude CVS --exclude build-* --exclude *~ --exclude .\#* $PACKAGE-$1
#rm $PACKAGE-$1
popd