#!/bin/sh -ex

# called by uscan with '--upstream-version' <version> <file>
TAR=../refdb_$2.orig.tar.gz
DIR=refdb-$2-1

# clean up the upstream tarball
tar -zxf $3
GZIP='--best --no-name' tar -czf $TAR --exclude '*/src/getopt*' $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
