#!/bin/sh -e

# called by uscan with '--upstream-version' <version> <file>
UDIR=jmac-$2
DDIR=libjmac-java-$2.orig

# clean up the upstream tarball
tar -x -z -f $3
mv $UDIR $DDIR
tar -c -z -f $3 -X debian/orig-tar.exclude $DDIR
rm -rf $DDIR $UDIR

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

