#! /bin/bash

echo ">>> Starting installation..."
echo ">>> Making install directory..."
mkdir st2006-alpha2
cd st2006-alpha2
echo ">>> Downloading package..."
wget ftp://ftp.schooltool.org/pub/schooltool/releases/2006.0-alpha2/SchoolTool-2006.0-alpha2.tgz
echo ">>> Unzipping and opening the tarball..."
tar -xzvf SchoolTool-2006.0-alpha2.tgz
cd SchoolTool-2006.0-alpha2
echo ">>> Running './configure --prefix=../st-a2'"
./configure --prefix=../libs
echo ">>> Running 'make'"
make
echo ">>> Running 'make install'"
make install
cd ../libs
echo ">>> Fetching required eggs..."
PYTHONPATH=lib/python easy_install -f http://download.zope.org/distribution --install-dir lib/python zc.table zc.datetimewidget hurry.query
mkdir ../st
echo ">>> Making an instance of SchoolTool..."
./bin/mkschooltoolinst -d../st
cd ../st
echo ">>> Running tests..."
./bin/test -ufv --testschooltool
echo
echo "You can now do:"
echo "cd st2006-alpha2/st/"
echo "and start the server with:"
echo "'./bin/schooltool-server'"
echo
echo "Access the server at:" 
echo "http://localhost:7080"
echo 
echo "The default login is:"
echo "Username: manager"
echo "Password: schooltool"
