#!/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

RT_VERSIONS=4

RTHOME=/usr/share/request-tracker4
PREFIX=$(RTHOME)/plugins/RTx-AssetTracker

%:
	dh $@ 


override_dh_auto_configure:
	PREFIX=$(PREFIX) dh_auto_configure


override_dh_install:
	dh_install

	for ver in $(RT_VERSIONS); do \
	 tmp=$(CURDIR)/debian/rt$$ver-extension-assettracker ; \
	 prefix=usr/share/request-tracker$$ver/plugins/RTx-AssetTracker ; \
	 mv $$tmp/$$prefix/etc/AssetTracker/* $$tmp/$$prefix/etc ; \
	 rmdir $$tmp/$$prefix/etc/AssetTracker ; \
	 rm -rf $$tmp/usr/share/perl5 ; \
	 rm -rf $$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 ; \
	done


override_dh_fixperms:
	dh_fixperms

	for ver in $(RT_VERSIONS); do \
	 tmp=$(CURDIR)/debian/rt$$ver-extension-assettracker ; \
	 prefix=usr/share/request-tracker$$ver/plugins/RTx-AssetTracker ; \
	 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 ; \
	done


override_dh_auto_test:
