#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

PACKAGE=$(shell dh_listpackages)

TMP=$(CURDIR)/debian/$(PACKAGE)
RTHOME=/usr/share/request-tracker3.8
PREFIX=$(RTHOME)/plugins/RTx-AssetTracker

%:
	dh $@ 


override_dh_auto_configure:
	PREFIX=$(PREFIX) dh_auto_configure


override_dh_auto_install:
	dh_auto_install

	# move these under our own space
	mv $(TMP)$(PREFIX)/etc/AssetTracker/* $(TMP)$(PREFIX)/etc
	rmdir $(TMP)$(PREFIX)/etc/AssetTracker

	# All the files live in the RT directories
	rm -rf $(TMP)/usr/share/perl5 $(TMP)/usr/share/man

	rm -rf $(TMP)$(PREFIX)/lib/t
	rm -f $(TMP)$(PREFIX)/sbin/at_factory.in
	rm -f $(TMP)$(PREFIX)/sbin/at-setup-database.in
	rm -f $(TMP)$(PREFIX)/sbin/extract_pod_tests


override_dh_fixperms:
	dh_fixperms

	chmod 755 $(TMP)$(PREFIX)/sbin/*
	find $(TMP)$(PREFIX)/lib $(TMP)$(PREFIX)/html $(TMP)$(PREFIX)/etc \
		-type f -perm -5 -print0 | xargs -0r chmod a-X


override_dh_auto_test:
