Whamcloud - gitweb
LU-17440 lnet: prevent errorneous decref for asym route
[fs/lustre-release.git] / lustre-dkms_pre-build.sh
index eea05e2..ce298cb 100755 (executable)
@@ -1,4 +1,15 @@
 #!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# lustre-dkms_pre-build.sh
+#
+# Script run before dkms build
+#
+
+#
 # $1 : $module
 # $2 : $module_version
 # $3 : $kernelver
@@ -6,6 +17,7 @@
 # $5 : $arch
 # $6 : $source_tree
 # $7 : $dkms_tree
+#
 
 case $1 in
     lustre-client)
@@ -20,7 +32,9 @@ case $1 in
        fi
 
        # ZFS and SPL are version locked
-       ZFS_VERSION=$(dkms status -m zfs -k $3 -a $5 | awk -F', ' '{print $2; exit 0}' | grep -v ': added$')
+       ZFS_VERSION=$(dkms status -m zfs -k $3 -a $5 2>/dev/null |
+                     sed -e 's:zfs/::g' -e 's:,.*::g' | cut -d: -f1 |
+                     sort -V | head -n1)
        if [ -z $ZFS_VERSION ] ; then
                echo "zfs-dkms package must already be installed and built under DKMS control"
                exit 1
@@ -28,10 +42,10 @@ case $1 in
 
        SERVER="--enable-server $LDISKFS \
                --with-linux=$4 --with-linux-obj=$4 \
-               --with-spl=$6/spl-${ZFS_VERSION} \
-               --with-spl-obj=$7/spl/${ZFS_VERSION}/$3/$5 \
-               --with-zfs=$6/zfs-${ZFS_VERSION} \
-               --with-zfs-obj=$7/zfs/${ZFS_VERSION}/$3/$5"
+               --with-spl=$(realpath $7/spl/${ZFS_VERSION}/source) \
+               --with-spl-obj=$(realpath $7/spl/kernel-$3-$5) \
+               --with-zfs=$(realpath $7/zfs/${ZFS_VERSION}/source) \
+               --with-zfs-obj=$(realpath $7/zfs/kernel-$3-$5)"
 
        KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4"
        ;;
@@ -76,7 +90,7 @@ fi
 # run a configure pass to clean "--enable-dist" only effect and also to
 # ensure local/on-target environment to be taken into account for
 # dkms.mkconf script customizations and before next build/MAKE step
-./configure --prefix=/usr --enable-modules --disable-iokit --disable-snmp \
+./configure --prefix=/usr --enable-modules --disable-iokit \
        --disable-doc --disable-utils --disable-tests --disable-maintainer-mode \
        $KERNEL_STUFF $GSS $SERVER $DKMS_CONFIG_OPTS \
        --disable-manpages --disable-mpitests