#!/bin/sh -e

VERSION=$2
TAR=../javamail_$VERSION.orig.tar.xz
DIR=javamail-$VERSION

mkdir -p $DIR
unzip ../$3 -d $DIR
rm ../$3
XZ_OPT=--best tar -c -J -f $TAR $DIR
rm -rf $DIR

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

