#!/bin/sh -e

VERSION=$2
DIR=mina2-$VERSION.orig
TAR=../mina2_$VERSION.orig.tar.xz

# clean up the upstream tarball
tar zxf $3
mv apache-mina-* $DIR
XZ_OPT=--best tar cJvf $TAR \
    --exclude 'LICENSE.*.txt' \
    $DIR
rm -rf $DIR
rm $3

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