#! /bin/bash
#
# Wrapper script for running debuild to build this package.

set -e

f=`cd .. && ls courier-analog-0.22.tar* | sed -n 1p`
rm -rf deb
mkdir deb
cp ../$f deb/`echo $f | sed 's/courier-analog-/courier-analog_/;s/.tar./.orig.tar./'`
cd deb
tar xf *
cd courier-analog-0.22
cp -pr packaging/debian .
debuild "$@"
cd ..
rm -rf courier-analog-0.22
echo "Built packages in the deb subdirectory."
