#!/bin/sh
set -e
################################################################################
#
#      Author:		Bob Fisch
#
#      Description:	
#
################################################################################
#
#      Revision List
#
#      Author						Date		Description
#      ------						----		-----------
#      Bob Fisch					2008.10.15  First Issue
#	   Bob Fisch & Philipp Hübner	2009.07.08  Scripting ameliorations
#	   Bob Fisch					2010.01.25	Update for new libraries and signature removing
#
################################################################################

echo "delete the old archive (if present)"
[ -f structorizer.jar ] && rm structorizer.jar

echo "make directory"
[ -d jar ] && rm -R jar
mkdir jar

echo "copy libs"
cp lib/* jar

echo "move into jar directory"
cd jar

echo "decompress jar's"
jar xf bsh-2.0b4.jar
jar xf swing-layout-1.0.3.jar
jar xf freehep-graphics2d-2.1.1.jar
jar xf freehep-graphicsio-2.1.1.jar
jar xf freehep-io-2.0.2.jar
jar xf freehep-swing-2.0.3.jar
jar xf freehep-util-2.0.2.jar
jar xf freehep-xml-2.1.1.jar
jar xf freehep-graphicsio-svg-2.1.1.jar
jar xf freehep.jar

echo "deleting signatures"
rm -f META-INF/*.SF
rm -f META-INF/*.DSA

echo "remove jar files"
rm *.jar

echo "go back"
cd ..

echo "copy other files"
cp -R bin/* jar/

echo "create an new archive"
jar cmf structorizer.big.manifest structorizer.jar -C jar/ .

echo "remove the jar-directory"
rm -R jar/

echo "execute the archive"
java -jar structorizer.jar
