#!/bin/sh
if [ -z $1 ];
then
	echo "usage: prepare-package <package>"
	exit 1;
fi
if [ -d $1 ];
then
	exit 0;
fi
F=
if [ -f $1.tar.gz ];
then
	F=$1.tar.gz
else
	if [ -f $1.tar.Z ];
	then
		F=$1.tar.Z
	fi
fi
if [ -z "$F" ];
then
	exit 0;
fi
cat $F | gzip -d | tar xvvvvf -
(cd $1 ; patch -p0 < ../$1.diff)
exit 0
