#!/bin/sh -e

# $1 = version
TAR=../liblaf-widget-java_$1.orig.tar.gz
DIR=liblaf-widget-java-$1.orig
ZIP=laf-widget-all.zip
# version 4.3
RELEASE_ID=135952

# download sources
wget https://laf-widget.dev.java.net/files/documents/5097/$RELEASE_ID/$ZIP

# clean up the upstream tarball
unzip -d $DIR $ZIP
GZIP=--best tar -c -z -f $TAR --exclude "$DIR/docs*" --exclude '*.jar' $DIR
rm -rf $DIR $ZIP

# move to directory 'tarballs'
if [ -r .svn/deb-layout ]; then
  . .svn/deb-layout
  mv $TAR $origDir
  echo "moved $TAR to $origDir"
fi

exit 0
