#!/bin/sh
if [ ! -f /etc/debian_version ] ; then
	echo "Not a debian or ubuntu distribution" 1>&2
	exit 1
fi
make -s -C debian
ezmlm_version=$(cat conf-version)
echo "Cleaning Stage"
/bin/rm -rf $HOME/stage/ezmlm-$ezmlm_version
echo "Copying Stage"
mkdir -p    $HOME/stage/ezmlm-$ezmlm_version
cp -rp .    $HOME/stage/ezmlm-$ezmlm_version
cd          $HOME/stage/ezmlm-$ezmlm_version
dpkg-buildpackage -tc -b
if [ $? -eq 0 ] ; then
	/bin/rm -rf $HOME/stage/ezmlm-$ezmlm_version
	ls -lt $HOME/stage
fi
