From e2b0f81b558bf407a76332b52be327afa276de58 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Fri, 2 Feb 2024 18:55:42 -0600 Subject: [PATCH] chore: don't patch for zfs 2.2.3 or newer (#12) Relates to: ublue-os/ucore#112 --- Containerfile | 3 ++- build-kmod-zfs.sh | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Containerfile b/Containerfile index 7787d4c..2561ab4 100644 --- a/Containerfile +++ b/Containerfile @@ -5,6 +5,7 @@ ARG COREOS_VERSION="${COREOS_VERSION:-stable}" FROM ${BASE_IMAGE}:${COREOS_VERSION} AS builder ARG COREOS_VERSION="${COREOS_VERSION:-stable}" +ARG ZFS_MINOR_VERSION="${ZFS_MINOR_VERSION:-2.2}" COPY build*.sh /tmp COPY certs /tmp/certs @@ -25,7 +26,7 @@ RUN /tmp/build-prep.sh RUN /tmp/build-ucore-addons.sh RUN /tmp/build-ucore-nvidia.sh RUN /tmp/build-kmod-nvidia.sh -RUN ZFS_MINOR_VERSION=2.2 /tmp/build-kmod-zfs.sh +RUN /tmp/build-kmod-zfs.sh RUN for RPM in $(find /var/cache/akmods/ -type f -name \*.rpm); do \ cp "${RPM}" /var/cache/rpms/kmods/; \ diff --git a/build-kmod-zfs.sh b/build-kmod-zfs.sh index 504728f..93d780b 100755 --- a/build-kmod-zfs.sh +++ b/build-kmod-zfs.sh @@ -27,7 +27,14 @@ echo "getting zfs-${ZFS_VERSION}.tar.gz" curl -L -O https://github.com/openzfs/zfs/releases/download/zfs-${ZFS_VERSION}/zfs-${ZFS_VERSION}.tar.gz tar xzf zfs-${ZFS_VERSION}.tar.gz -patch -b -uN -i zfs-kmod-spec-in.patch zfs-${ZFS_VERSION}/rpm/generic/zfs-kmod.spec.in +# patch the zfs-kmod.spec.in file for older zfs versions +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 +fi cd /tmp/zfs-${ZFS_VERSION} ./configure \ -with-linux=/usr/src/kernels/${KERNEL}/ \