#!/bin/sh

TDIR=COMPONENTS/${DH_COMPONENT}
DESTDIR=debian/

if [ -z ${PACKAGE} ]
then
    echo PACKAGE not set
    exit 1
fi
PERL=$(which perl)
PERL="${PERL} -I../../debian/${PACKAGE}/usr/share/perl5"

if [ -z ${DH_COMPONENT} ]
then
    echo DH_COMPONENT not set
    exit 1
fi

if [ ! -d ${TDIR} ]
then
    echo ${TDIR} not a directory
    exit 1
fi

if dh_auto_install -D ${TDIR}
then
    EXIT_STATUS=0
else
    EXIT_STATUS=1
fi

if [ -e ${DH_COMPONENT}/ChangeLog ]
then
  if dh_install ${TDIR}/ChangeLog usr/share/doc/${PACKAGE}/${DH_COMPONENT}
  then
      EXIT_STATUS=0
  else
      EXIT_STATUS=1
  fi
fi

exit $EXIT_STATUS


