#!/bin/sh

PWD1=`pwd`
TMPDIR=`mktemp -d`
UPSTREAMVERSION="$2"
if [ x"$UPSTREAMVERSION" = x ]; then
    UPSTREAMVERSION=`echo $1 | sed 's/.*Mobile Atlas Creator \([0-9.]*\) src\.zip/\1/'`
fi

cd $TMPDIR
SRCDIR=mobile-atlas-creator-"$UPSTREAMVERSION""+dfsg.1"
mkdir "$SRCDIR"
cd "$SRCDIR"
unzip $PWD1/"$1"
rm -f lib/*
rm -f *.exe
cd $TMPDIR
tar czvf mobile-atlas-creator_"$UPSTREAMVERSION""+dfsg.1".orig.tar.gz $SRCDIR
cd $PWD1
mv -f $TMPDIR/mobile-atlas-creator_"$UPSTREAMVERSION""+dfsg.1".orig.tar.gz ..
uupdate -v "$UPSTREAMVERSION""+dfsg.1" ../mobile-atlas-creator_"$UPSTREAMVERSION""+dfsg.1".orig.tar.gz
