#!/bin/bash

#
# This script is used for preparing the tarballs.
# Do not use it, please.
#

#
# DeMorgan rules applied :-) I like math...
#

if [ "x`whoami`" != xpavel -a "x`whoami`" != xhugh -a "x`whoami`" != xpkot ]
then
   echo "No way to test this :-)"
fi

VERSION=`cat ../VERSION`
GNOKIIDIR=`dirname $PWD`
rm -rf /tmp/gnokii-${VERSION}
cp -r ${GNOKIIDIR} /tmp/gnokii-${VERSION}

# Some files and directories in CVS are useless
rm -rf /tmp/gnokii-${VERSION}/xkeyb
rm -rf /tmp/gnokii-${VERSION}/xlogo*

(
   cd /tmp/gnokii-${VERSION}
   autoconf
   ./configure
   cp packaging/RedHat/gnokii.spec .
   make distclean
   chmod 755 mkinstalldirs
   cd ..
   tar cvfz /tmp/gnokii-${VERSION}.tar.gz gnokii-${VERSION} --exclude CVS
)

rm -rf /tmp/gnokii-${VERSION}

echo "Distribution generated in /tmp/gnokii-${VERSION}.tar.gz"
