Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
refactor: zfs version patch logic is more correct (#14)
Browse files Browse the repository at this point in the history
this merge changes nothing about new builds as they already don't patch, but makes logic more correct for anyone trying to build an older zfs version into a custom image.
  • Loading branch information
bsherman authored Mar 14, 2024
1 parent e2b0f81 commit 1b5b5c3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions build-kmod-zfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}/ \
Expand Down

0 comments on commit 1b5b5c3

Please sign in to comment.