Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
ZFS_VERSION="0.7.9"
CONTAINER=$(buildah from fedora:28)
buildah run $CONTAINER dnf clean all
buildah run $CONTAINER dnf -y update
buildah run $CONTAINER dnf -y install \
autoconf \
automake \
createrepo \
elfutils-libelf-devel \
ksh \
libattr-devel \
libblkid-devel \
libselinux-devel \
libtirpc-devel \
libtool \
libudev-devel \
libuuid-devel \
lsscsi \
make \
openssl-devel \
parted \
rpm-build \
wget \
zlib-devel
buildah run $CONTAINER dnf -y install kernel-devel
KERNEL_VERSION=$(buildah run $CONTAINER bash -c "rpm -q kernel-devel|sed 's/kernel-devel-//'")
buildah run $CONTAINER wget -O /root/spl-$ZFS_VERSION.tar.gz https://github.com/zfsonlinux/zfs/releases/download/zfs-$ZFS_VERSION/spl-$ZFS_VERSION.tar.gz
buildah run $CONTAINER wget -O /root/zfs-$ZFS_VERSION.tar.gz https://github.com/zfsonlinux/zfs/releases/download/zfs-$ZFS_VERSION/zfs-$ZFS_VERSION.tar.gz
buildah run $CONTAINER tar xf /root/spl-$ZFS_VERSION.tar.gz -C /root
buildah run $CONTAINER bash -c "cd /root/spl-$ZFS_VERSION; ./configure; make -s -j$(nproc)"
buildah run $CONTAINER bash -c "cd /root/spl-$ZFS_VERSION; make -j1 pkg-utils pkg-kmod"
buildah run $CONTAINER dnf -y install \
/root/spl-$ZFS_VERSION/spl-$ZFS_VERSION-1.fc28.x86_64.rpm \
/root/spl-$ZFS_VERSION/kmod-spl-devel-$ZFS_VERSION-1.fc28.x86_64.rpm \
/root/spl-$ZFS_VERSION/kmod-spl-$KERNEL_VERSION-$ZFS_VERSION-1.fc28.x86_64.rpm \
/root/spl-$ZFS_VERSION/kmod-spl-devel-$KERNEL_VERSION-$ZFS_VERSION-1.fc28.x86_64.rpm
buildah run $CONTAINER tar xf /root/zfs-$ZFS_VERSION.tar.gz -C /root
buildah run $CONTAINER bash -c "cd /root/zfs-$ZFS_VERSION; ./configure; make -s -j$(nproc)"
buildah run $CONTAINER bash -c "cd /root/zfs-$ZFS_VERSION; make -j1 pkg-utils pkg-kmod"
mkdir ~/zfs-rpms
MOUNTPOINT=$(buildah mount $CONTAINER)
mv $MOUNTPOINT/root/{spl,zfs}-$ZFS_VERSION/*.rpm ~/zfs-rpms
buildah rm $CONTAINER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment