#!/bin/sh

revision=$1
release=${2-$revision}
dir="bs-$release"
file="big-sister-$release"

if fakeroot true 2>/dev/null; then
    fakeroot=fakeroot
else
    echo "WARNING: fakeroot not available"
	fakeroot=""
fi

echo "exporting bigsister $revision from CVS"
cvs -Q export -r $revision -d $dir bigsister
mv $dir/bigsister/* $dir
rmdir $dir/bigsister

echo "installing symbolic links"
for link in `find uxmon skins -type l -print`; do
    tar -cf - $link | (cd $dir; tar -xf -)
done

cd $dir
echo '*********** doing a 'diff' - just to be sure ************'
diff -r . .. | grep -v 'Only.*: CVS' | grep -v '^<' | grep -v '^>' | grep -v '^--' | grep -v '^[0-9]'
echo '************** that is the end ***************************'

if [ -f ../../documentation.tgz ]; then
    tar xzf ../../documentation.tgz docu
fi

echo "making html doc"
mkdir doc
perl ../contrib/Makedoc.pl 

cd ..
echo creating $file.tar.gz
$fakeroot tar -czf $file.tar.gz $dir
