diff --git a/scripts/dkms.mkconf b/scripts/dkms.mkconf index 880510abd3..88c289383e 100755 --- a/scripts/dkms.mkconf +++ b/scripts/dkms.mkconf @@ -25,7 +25,22 @@ PACKAGE_CONFIG="${pkgcfg}" PRE_BUILD="configure --prefix=/usr --with-config=kernel - --with-linux=\${kernel_source_dir} + --with-linux=\$( + case \`lsb_release -is\` in + (Debian|Devuan) + if [[ -e \${kernel_source_dir/%build/source} ]] + then + echo \${kernel_source_dir/%build/source} + else + # A kpkg exception for Proxmox 2.0 + echo \${kernel_source_dir} + fi + ;; + (*) + echo \${kernel_source_dir} + ;; + esac + ) --with-linux-obj=\${kernel_source_dir} --with-spl=\${source_tree}/spl-\${PACKAGE_VERSION} --with-spl-obj=\${dkms_tree}/spl/\${PACKAGE_VERSION}/\${kernelver}/\${arch}