diff --git a/Makefile b/Makefile index 78bb23af2..36545d500 100644 --- a/Makefile +++ b/Makefile @@ -367,6 +367,10 @@ dpkg: ../scst_$(VERSION).orig.tar.gz [ -z "$$DEBFULLNAME" ] || export DEBFULLNAME="Bart Van Assche" &&\ sed 's/%{scst_version}/$(VERSION)/' \ debian/scst.dkms && \ + sed 's/%{KVER}/$(KVER)/' \ + debian/scst.preinst && \ + sed 's/%{KVER}/$(KVER)/' \ + debian/scst.postinst && \ output_files=( \ ../*_$(VERSION)-$(DEBIAN_REVISION)_*.deb \ ../*_$(VERSION)-$(DEBIAN_REVISION)_*.ddeb \ @@ -387,11 +391,7 @@ dpkg: ../scst_$(VERSION).orig.tar.gz else \ buildopts+=(-j4); \ fi && \ - if false; then \ - dpkg-buildpackage "$${buildopts[@]}"; \ - else \ - debuild "$${buildopts[@]}" --lintian-opts --profile debian; \ - fi && \ + DEB_CC_SET="$(CC)" DEB_KVER_SET=$(KVER) DEB_KDIR_SET=$(KDIR) debuild "$${buildopts[@]}" --lintian-opts --profile debian && \ mkdir -p dpkg && \ for f in "$${output_files[@]}" ../scst_$(VERSION).orig.tar.[gx]z; do\ mv $$f dpkg || true; \ diff --git a/debian/rules b/debian/rules index f78e364a0..efd2cf134 100755 --- a/debian/rules +++ b/debian/rules @@ -17,6 +17,12 @@ SUBDIRS=scst fcst iscsi-scst qla2x00t/qla2x00-target scst_local scstadmin srpt DESTDIR=$(CURDIR)/debian/tmp VERSION:=$(shell head -n1 debian/changelog | sed 's/.*(\([0-9.]*\).*).*/\1/') +# rules won't see variables unless they're using DEB_foo_SET syntax. So use that as +# an intermediary. Also, export variables for sub-makes to be able to see them. +export KVER=$(DEB_KVER_SET) +export KDIR=$(DEB_KDIR_SET) +export CC=$(DEB_CC_SET) + %: echo "*** dh $@ ***" dh $@ @@ -24,7 +30,8 @@ VERSION:=$(shell head -n1 debian/changelog | sed 's/.*(\([0-9.]*\).*).*/\1/') clean: dh_testdir && \ dh_prep -Xqla_isp/TAGS -Xdebian/changelog && \ - scripts/clean-source-tree -x debian/changelog -x debian/compat + scripts/clean-source-tree -x debian/changelog -x debian/compat -x debian/scst.preinst \ + -x debian/scst.postinst build: make 2release && \ diff --git a/debian/scst.postinst b/debian/scst.postinst.in similarity index 98% rename from debian/scst.postinst rename to debian/scst.postinst.in index d1569e33c..f535eebd9 100644 --- a/debian/scst.postinst +++ b/debian/scst.postinst.in @@ -23,7 +23,7 @@ case "$1" in mkdir -p /var/lib/scst/dif_tags mkdir -p /var/lib/scst/pr mkdir -p /var/lib/scst/vdev_mode_pages - depmod;; + depmod "%{KVER}";; abort-upgrade|abort-remove|abort-deconfigure) ;; diff --git a/debian/scst.preinst b/debian/scst.preinst.in similarity index 94% rename from debian/scst.preinst rename to debian/scst.preinst.in index 4d5af2eaf..199a4e275 100644 --- a/debian/scst.preinst +++ b/debian/scst.preinst.in @@ -17,7 +17,7 @@ set -e case "$1" in install) # Remove any existing ib_srpt.ko kernel modules - find "/lib/modules/$(uname -r)" -name ib_srpt.ko -exec rm {} \; + find "/lib/modules/%{KVER}" -name ib_srpt.ko -exec rm {} \; # Remove files installed by "make install" rm -f /usr/local/man/man5/iscsi-scstd.conf.5 rm -f /usr/local/man/man8/iscsi-scst-adm.8