From 17d7f9de971a8584c141ee612ce3e07e9b56e40f Mon Sep 17 00:00:00 2001 From: Andrew Walker Date: Wed, 24 Feb 2021 09:50:53 -0500 Subject: [PATCH] Add check for custom TrueNAS kernel Signed-off-by: Ryan Moeller --- contrib/truenas/rules | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/contrib/truenas/rules b/contrib/truenas/rules index fe51e0858b..907bacb488 100644 --- a/contrib/truenas/rules +++ b/contrib/truenas/rules @@ -4,10 +4,25 @@ export DH_VERBOSE = 1 %: dh $@ -src!= dpkg --get-selections | awk '/^linux-headers-.*-common/ { print $$1 }' -obj!= dpkg --get-selections | awk '/^linux-headers-.*-amd64/ { print $$1 }' -krn!= dpkg --get-selections | awk '/^linux-image-.*-amd64/ { print $$1 }' -kmod= kmod-zfs-$(subst linux-image-,,$(krn)) +debarch!= dpkg --print-architecture +# Prefer the TrueNAS kernel image but fall back to the generic image. +image!= apt info 'linux-image-truenas-$(debarch)' 'linux-image-$(debarch)' | \ + awk '/^Package:/ { print $$2; exit }' + +ifneq (,$(findstring truenas,$(image))) + # TrueNAS kernel image *is not* a metapackage + vers!= apt info $(image) | awk '/^Source:/ { print $$2 }' | \ + sed 's/linux-//' + obj= linux-headers-$(vers) + src= $(obj) + kmod= kmod-zfs-$(vers) +else + # Debian kernel image *is* a metapackage + krn!= apt info $(image) | awk '/^Depends:/ { print $$2 }' + obj= $(subst image,headers,$(krn)) + src= $(subst $(debarch),common,$(obj)) + kmod= kmod-zfs-$(subst linux-image-,,$(krn)) +endif override_dh_auto_configure: dh_auto_configure -- \