#!/bin/sh
set -e
tomcatdir=/var/lib/tomcat7
webappdir=$tomcatdir/webapps/PackageManager

if [ ! -f $webappdir/WEB-INF/tools.xml ]
then
	cp $webappdir/WEB-INF/tools.xml.dist $webappdir/WEB-INF/tools.xml
	chmod g-wx,o-rwx $webappdir/WEB-INF/tools.xml
	chgrp tomcat7 $webappdir/WEB-INF/tools.xml
	cp $webappdir/WEB-INF/web.xml.dist $webappdir/WEB-INF/web.xml
	update-rc.d dasspackagemanager defaults
fi
invoke-rc.d dasspackagemanager restart
