#!/bin/sh

# copyright 2004 vagrant@freegeek.org, distributed under the terms of the
# GNU General Public License version 2 or any later version.

if [ ! -e debian/rules ] && [ -e distrib/debian ]; then
  ln -s distrib/debian
fi

fakeroot debian/rules clean
cvs update
# try to automatically generate the changelog before building package
if [ -n $(which cvs2cl) ]; then
  cvs2cl
else
  echo  "creating dummy ChangeLog- install cvs2cl for normal changelog"
  touch ChangeLog
fi
fakeroot dpkg-buildpackage

# clean up, unless told otherwise
test "$1" = "noclean" || fakeroot debian/rules clean

if [ -L debian ]; then
  rm debian
fi
