#!/bin/bash
#
#  Script to start build a debian package
#  Copyright 2003 by Geert Stappers under the terms of GPL v2.0
#

#
if [ -d debian ]
then
  echo There is already a debian directory
  echo assuming there is no need to run this script
  echo gonna exit it
  echo mayby you want to do \`debian/rules binary\`
  exit 1
fi

if [ "G${0}" != "Gdeb/build" ]
then
  echo We expect you to run this script as \`deb/build\`
  echo  to make sure you are in the toplevel directory of this project.
  exit 1
fi

if [ ! -x ./configure ]
then
  echo Assuming you did a fresh CVS checkout,
  echo gonna run \`./autogen.sh\` for you to create the initial Makefiles.
  ./autogen.sh
fi

DEBIAN_FILES="rules control changelog copyright docs compat
 conglomerate.menu conglomerate_icon.xpm
 NEWS watch"

echo coping  deb directory into debian
mkdir -p debian
for DF in ${DEBIAN_FILES}
do
  cp deb/${DF} debian
done

# assuming the user has debian development stuff installed
# ( this is the place where a test on such executables should done )

echo gonna build the package
debian/rules binary

echo one directory level up, are these .deb files:
ls -ltr ../*.deb

# end of script
