From 464f85940b23d4904aa538452661da95db244ea3 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Thu, 14 Mar 2024 10:17:39 -0500 Subject: [PATCH] refactor: zfs version patch logic is more correct Fixes: https://github.com/ublue-os/ucore/issues/112 --- build-kmod-zfs.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/build-kmod-zfs.sh b/build-kmod-zfs.sh index 93d780b..1afeca1 100755 --- a/build-kmod-zfs.sh +++ b/build-kmod-zfs.sh @@ -28,13 +28,21 @@ curl -L -O https://github.com/openzfs/zfs/releases/download/zfs-${ZFS_VERSION}/z tar xzf zfs-${ZFS_VERSION}.tar.gz # patch the zfs-kmod.spec.in file for older zfs versions +ZFS_MAJ=$(echo $ZFS_VERSION | cut -f1 -d.) ZFS_MIN=$(echo $ZFS_VERSION | cut -f2 -d.) ZFS_PATCH=$(echo $ZFS_VERSION | cut -f3 -d.) -if [ "${ZFS_MIN}" -lt "3" ]; then - if [ "${ZFS_PATCH}" -lt "3" ]; then - patch -b -uN -i zfs-kmod-spec-in.patch zfs-${ZFS_VERSION}/rpm/generic/zfs-kmod.spec.in - fi +DO_PATCH=1 +if [ "${ZFS_MAJ}" -lt "2" ]; then + DO_PATCH=0 +elif [ "${ZFS_MAJ}" -eq "2" ] && [ "${ZFS_MIN}" -lt "2" ]; then + DO_PATCH=0 +elif [ "${ZFS_MAJ}" -eq "2" ] && [ "${ZFS_MIN}" -eq "2" ] && [ "${ZFS_PATCH}" -lt "3" ]; then + DO_PATCH=0 fi +if [ "${DO_PATCH}" -eq "0" ]; then + patch -b -uN -i zfs-kmod-spec-in.patch zfs-${ZFS_VERSION}/rpm/generic/zfs-kmod.spec.in +fi + cd /tmp/zfs-${ZFS_VERSION} ./configure \ -with-linux=/usr/src/kernels/${KERNEL}/ \