From eadcbeae3fb2477b4e76170e5708ed4f815ec926 Mon Sep 17 00:00:00 2001
From: Philipp <hahn@univention.de>
Date: Mon, 27 Oct 2014 13:24:31 +0100
Subject: [PATCH] Bug #35875 DKMS: iscsitarget

Fix DKMS postinstall not finding kernel headers in chroot.
---
 debian/clean   |    1 +
 debian/control |    2 +-
 debian/rules   |    6 +++---
 3 files changed, 5 insertions(+), 4 deletions(-)
 create mode 100644 debian/clean

diff --git a/debian/clean b/debian/clean
new file mode 100644
index 0000000..11e85a7
--- /dev/null
+++ b/debian/clean
@@ -0,0 +1 @@
+debian/dkms.conf
diff --git a/debian/control b/debian/control
index 09545a8..69d7bd9 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: net
 Priority: optional
 Maintainer: Debian iSCSI Maintainers <pkg-iscsi-maintainers@lists.alioth.debian.org>
 Uploaders: Philipp Hug <debian@hug.cx>, Guido Guenther <agx@sigxcpu.org>, Frederik Schüler <fs@debian.org>, Ritesh Raj Sarraf <rrs@debian.org>
-Build-Depends: debhelper (>= 5.0.0), libssl-dev, bzip2
+Build-Depends: debhelper (>= 5.0.0), libssl-dev, bzip2, dkms
 Standards-Version: 3.9.2
 Homepage: http://iscsitarget.sourceforge.net/
 Vcs-Git: git://anonscm.debian.org/pkg-iscsi/iscsitarget.git
diff --git a/debian/rules b/debian/rules
index c87a7fb..d250c5e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -234,9 +234,9 @@ install-indep:
 	echo "obj-m = kernel/" > debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/Makefile
 	
 	# Prepare dkms.conf from the dkms.conf.in template
-	sed "s/__VERSION__/$(DEB_UPSTREAM_VERSION)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/dkms.conf
-	grep ^PATCH dkms.conf >> debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/dkms.conf
-
+	sed "s/__VERSION__/$(DEB_UPSTREAM_VERSION)/g" debian/dkms.conf.in > debian/dkms.conf
+	grep ^PATCH dkms.conf >> debian/dkms.conf
+	dh_dkms -p$(pdkms) -- debian/dkms.conf
 
 	dh_install -i
 
-- 
1.7.2.5

