Skip to content

Instantly share code, notes, and snippets.

@df-a
Created March 8, 2021 17:08
Show Gist options
  • Save df-a/b8446d2dee812df576997dce1706c6c6 to your computer and use it in GitHub Desktop.
Save df-a/b8446d2dee812df576997dce1706c6c6 to your computer and use it in GitHub Desktop.
Parrot OS ZFS installer script
#!/bin/dash
sudo apt-get install -y git build-essential autoconf automake libtool gawk alien fakeroot dkms libblkid-dev uuid-dev libudev-dev libssl-dev zlib1g-dev libaio-dev libattr1-dev libelf-dev linux-headers-$(uname -r) python3 python3-dev python3-setuptools python3-cffi libffi-dev || return;
sudo rm -r zfs;
git clone --recursive --recurse-submodules --single-branch --branch master https://github.com/openzfs/zfs.git || return;
cd zfs || return;
sh autogen.sh CFLAGS="-m64 -march=native -mtune=native -flto -fuse-linker-plugin -O3" CPPFLAGS="-m64 -march=native -mtune=native -flto -fuse-linker-plugin -O3" C++FLAGS="-m64 -march=native -mtune=native -flto -fuse-linker-plugin -O3" LDFLAGS="-m64 -march=native -mtune=native -flto -fuse-linker-plugin -O3" || return;
./configure --prefix=/ --libdir=/lib --includedir=/usr/include --datarootdir=/usr/share --enable-systemd CFLAGS="-m64 -march=native -mtune=native -flto -fuse-linker-plugin -O3" CPPFLAGS="-m64 -march=native -mtune=native -flto -fuse-linker-plugin -O3" LDFLAGS="-m64 -march=native -mtune=native -flto -fuse-linker-plugin -O3" || return;
make -j1 deb-utils deb-dkms CFLAGS="-m64 -march=native -mtune=native -flto -fuse-linker-plugin -O3" CPPFLAGS="-m64 -march=native -mtune=native -flto -fuse-linker-plugin -O3" C++FLAGS="-m64 -march=native -mtune=native -flto -fuse-linker-plugin -O3" LDFLAGS="-m64 -march=native -mtune=native -flto -fuse-linker-plugin -O3" || return;
rm -r ../.package.temp;
mv ../package ../.package.temp;
mkdir ../package || return;
mv *.deb ../package/ || return;
cd ../package || return;
sudo dkms remove -m zfs -v $(dkms status | grep zfs | awk -F ", " '{print $2}') --all;
sudo apt-get reinstall -y ./*.deb --allow-downgrades --allow-change-held-packages || return;
sudo dkms uninstall -m zfs -v $(dkms status | grep zfs | awk -F ", " '{print $2}') --all || return;
sudo dkms install --force -m zfs -v $(dkms status | grep zfs | awk -F ", " '{print $2}') || return;
sudo apt-mark hold libzfs2 libzfs2-devel libzpool2 python3-pyzfs zfs zfs-dkms zfs-dracut zfs-initramfs zfs-test || return;
sudo update-initramfs -u;
rm -r ../.package.old;
mv ../.package.temp ../.package.old || return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment