#!/bin/bash

# Written by Dirk Gomez (openacs@dirkgomez.de) on 11-Sep-2006
# License: GPL

if [ ! -d debian/debian/var/www/www ]; then
    echo "You need to put a .LRN or OpenACS checkout into debian/debian/var/www/. "
    exit 1
fi

echo "Removing CVS directories"
find . -name "CVS" -exec rm -rf {} \;

echo "Setting the permissions on the package shell scripts"
chmod 755 debian/debian/DEBIAN/control debian/debian/DEBIAN/postinst debian/debian/DEBIAN/prerm
chown -R root:root debian/debian/DEBIAN/control debian/debian/DEBIAN/postinst debian/debian/DEBIAN/prerm

echo "Setting OpenACS' ownership to www-data. We may want to set proper permissions here in the future."
chown -R www-data:www-data debian/debian/var/www
rm debian/debian/var/www/put-your-distro-here

echo "Building the debian package"
pushd debian
dpkg-deb --build debian
mv debian.deb ../dotlrn-2.2.0-0.deb 
popd