#!/bin/sh

# This script is executed ONCE, just after an update (or a new installation)
# It is launched by /usr/local/etc/rc.d/univnautes.sh

echo "delete all .pyc/.pyo files"
cd /usr/local/univnautes/
for d in pffedportal pfidp lib/python2.7
do
	find $d -type f -name "*.pyc" -exec rm -f {} \;
	find $d -type f -name "*.pyo" -exec rm -f {} \;
done

echo "delete obsoletes files"
for obso in etc/rc.d/pffedportal.sh \
	univnautes/rc.d/pffedportal.sh \
	univnautes/bin/pffedportal-postupdate \
	univnautes/bin/pffedportal-postupdate.done \
	univnautes/bin/univnautes-cleanup-pffedportal.sh \
	univnautes/bin/univnautes-init-pffedportal-db.sh \
	bin/univnautes-cleanup-pffedportal.sh \
	bin/univnautes-init-pffedportal-db.sh \
	univnautes/authentic \
	univnautes/bin/python2.6 \
	univnautes/bin/easy_install-2.6 \
	univnautes/lib/python2.6 \
	univnautes/include/python2.6
do
	echo "  rm -rf /usr/local/${obso}"
	rm -rf /usr/local/${obso}
done

echo "delete portal and idp databases (will be re-created)"
rm -f /usr/local/univnautes/pffedportal/pffedportal.db
rm -f /usr/local/univnautes/pfidp/pfidp.db

