#!/usr/bin/env bash # All the zfs packages in debian stretch apt-get install -y dkms busybox-static apt-get install -y initramfs-tools dh-autoreconf apt-get install -y spl spl-dkms apt-get install -y linux-headers-$(uname -r) zfs-dkms zfs-initramfs zfsutils-linux apt-get install -y zfs-zed # linux default, mount partitions even if non-empty, the no option really only makes sense if the directory being mounted on has been declared as a mount point only and is therefore guaranteed to be empty. sed -i "s,^\(DO_OVERLAY_MOUNTS=\).*,\1\'yes\'," /etc/default/zfs # Allow readonly zfs to non-root users in sudoers (put in place by zfsutils-linux) sed -ie 's/^#//' /etc/sudoers.d/zfs ## or change below to change sudo behavior further: #cat > /etc/sudoers.d/zfs << 'EOF' ## Allow read-only ZoL commands to be called through sudo ## without a password. Remove the first '#' column to enable. ## ## CAUTION: Any syntax error introduced here will break sudo. ## ## Cmnd alias specification #Cmnd_Alias C_ZFS = \ # /sbin/zfs "", /sbin/zfs help *, \ # /sbin/zfs get, /sbin/zfs get *, \ # /sbin/zfs list, /sbin/zfs list *, \ # /sbin/zpool "", /sbin/zpool help *, \ # /sbin/zpool iostat, /sbin/zpool iostat *, \ # /sbin/zpool list, /sbin/zpool list *, \ # /sbin/zpool status, /sbin/zpool status *, \ # /sbin/zpool upgrade, /sbin/zpool upgrade -v # ## allow any user to use basic read-only ZFS commands #ALL ALL = (root) NOPASSWD: C_ZFS #EOF modprobe zfs