#!/bin/sh NAME="brazil" VERSION=2.3 echo "Downloading jar..." # Upstream lives in the Sun Download Center, which normally requires a login # and limits the number of times you can download the package, /however/, the # download link from the project page at http://research.sun.com/brazil/ goes # to a page that performs some magic that apparently obviates all of these # restrictions entirely. Considering that this magic is performed by one of # upstream's own pages, I think it's fair to use that mechanism to download it, # which is the reason for the following bit of fruity script: POST_URL=$(wget -q --user-agent="Mozilla/5.0 (U) Firefox/2.0.0.10" --keep-session-cookies --save-cookies=cookie \ http://www.experimentalstuff.com/Technologies/Brazil/download.html -O - | grep jsessionid | cut -d \" -f 4) POST_SESSION=$(echo $POST_URL | cut -d = -f 3) wget -q --user-agent="Mozilla/5.0 (U) Firefox/2.0.0.10" --load-cookies=cookie --keep-session-cookies --save-cookies=cookie \ --referer=http://www.experimentalstuff.com/Technologies/Brazil/download.html --post-data "url=$POST_URL&session=$POST_SESSION&licenseOK=accept" \ http://www.experimentalstuff.com/Technologies/Brazil/download.html -O - >/dev/null URL=$(wget -q --user-agent="Mozilla/5.0 (U) Firefox/2.0.0.10" --load-cookies=cookie --keep-session-cookies --save-cookies=cookie \ --referer=http://www.experimentalstuff.com/Technologies/Brazil/download.html --post-data "noTemplate=true&product=$NAME-$VERSION.jar" \ http://www.experimentalstuff.com/Technologies/download.html -O - | grep location= | cut -d \" -f 2) wget -q --no-cookies $URL -O $NAME-$VERSION.jar rm cookie echo "Unzipping jar..." mkdir $NAME-$VERSION unzip -q -d $NAME-$VERSION $NAME-$VERSION.jar 1>/dev/null 2>/dev/null rm $NAME-$VERSION.jar # jettison empty files and pre-built binaries and javadocs rm $NAME-$VERSION/*.changed rm -rf $NAME-$VERSION/com $NAME-$VERSION/contrib $NAME-$VERSION/sunlabs $NAME-$VERSION/tcl $NAME-$VERSION/tests \ $NAME-$VERSION/html $NAME-$VERSION/META-INF # remove source from a different project with a different license rm $NAME-$VERSION/samples/conman/misc/app_meetme.c echo "Creating tarball '$NAME-$VERSION.tar.gz'..." tar -czf $NAME-$VERSION.tar.gz $NAME-$VERSION