kobol-wiki/docs/helios64/files/zfs/install-zfs.sh

50 lines
1.4 KiB
Bash
Raw Normal View History

2021-02-24 12:24:48 +01:00
#!/bin/bash
#define zfs version
zfsver="zfs-2.0.3"
#creating building directory
mkdir /tmp/zfs-builds && cd "$_"
2021-02-26 07:54:24 +01:00
rm -rf /tmp/zfs-builds/build-zfs.sh
2021-02-24 12:24:48 +01:00
apt-get download linux-headers-current-rockchip64
git clone -b $zfsver https://github.com/openzfs/zfs.git $zfsver-$(uname -r)
#create file to execute inside container
2021-02-26 07:54:24 +01:00
echo "creating ZFS build script to be executed inside container"
cat > /tmp/zfs-builds/build-zfs.sh <<EOF
2021-02-24 12:24:48 +01:00
#!/bin/bash
cd scratch/
dpkg -i linux-headers-current-*.deb
cd "/scratch/$zfsver-$(uname -r)"
sh autogen.sh
./configure
make -s -j$(nproc)
make deb
mkdir "/scratch/deb-$zfsver-$(uname -r)"
cp *.deb "/scratch/deb-$zfsver-$(uname -r)"
rm -rf "/scratch/$zfsver-$(uname -r)"
exit
EOF
2021-02-26 07:54:24 +01:00
chmod +x /tmp/zfs-builds/build-zfs.sh
2021-02-24 12:24:48 +01:00
echo ""
echo "####################"
echo "starting container.."
echo "####################"
echo ""
2021-02-26 07:54:24 +01:00
docker run --rm -it -v /tmp/zfs-builds:/scratch zfs-build-ubuntu-bionic:0.1 /bin/bash /scratch/build-zfs.sh
2021-02-24 12:24:48 +01:00
# Cleanup packages (if installed).
modprobe -r zfs zunicode zzstd zlua zcommon znvpair zavl icp spl
apt remove --yes zfsutils-linux zfs-zed zfs-initramfs
apt autoremove --yes
dpkg -i "/tmp/zfs-builds/deb-$zfsver-$(uname -r)"/kmod-zfs-$(uname -r)*.deb
2021-02-26 07:54:24 +01:00
dpkg -i "/tmp/zfs-builds/deb-$zfsver-$(uname -r)"/{libnvpair3,libuutil3,libzfs4,libzpool4,python3-pyzfs,zfs}_*.deb
2021-02-24 12:24:48 +01:00
echo ""
echo "###################"
echo "building complete"
echo "###################"
echo ""