diff options
-rw-r--r-- | .SRCINFO | 46 | ||||
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | PKGBUILD | 131 | ||||
-rw-r--r-- | zfs-node-permission.conf | 1 | ||||
-rw-r--r-- | zfs-utils.install | 18 | ||||
-rw-r--r-- | zfs.initcpio.hook (renamed from zfs-utils.initcpio.hook) | 84 | ||||
-rw-r--r-- | zfs.initcpio.install (renamed from zfs-utils.initcpio.install) | 5 | ||||
-rw-r--r-- | zfs.initcpio.zfsencryptssh.install (renamed from zfs-utils.initcpio.zfsencryptssh.install) | 2 |
8 files changed, 186 insertions, 109 deletions
@@ -1,36 +1,38 @@ pkgbase = zfs-utils-git - pkgdesc = Kernel module support files for the Zettabyte File System. - pkgver = 2019.12.02.r5555.ge69bb31b7 + pkgdesc = Userspace utilities for the Zettabyte File System. + pkgver = 2.2.99.r344.ga0635ae731 pkgrel = 1 - url = http://zfsonlinux.org/ - install = zfs-utils.install + epoch = 2 + url = https://zfsonlinux.org/ + arch = i686 arch = x86_64 - groups = archzfs-linux-git + arch = aarch64 + groups = zfs-git license = CDDL makedepends = python makedepends = python-setuptools makedepends = python-cffi makedepends = git - optdepends = python: pyzfs and extra utilities, + optdepends = python: pyzfs and extra utilities optdepends = python-cffi: pyzfs - provides = zfs-utils - provides = spl-utils + provides = zfs-utils=2.2.99.r344.ga0635ae731 conflicts = zfs-utils - conflicts = spl-utils - replaces = spl-utils-common-git - replaces = zfs-utils-common-git - backup = etc/zfs/zed.d/zed.rc backup = etc/default/zfs - backup = etc/modules-load.d/zfs.conf - backup = etc/sudoers.d/zfs - source = git+https://github.com/zfsonlinux/zfs.git#commit=e69bb31b71f60b338fa5510dc48de298f394ad73 - source = zfs-utils.initcpio.install - source = zfs-utils.initcpio.hook - source = zfs-utils.initcpio.zfsencryptssh.install + backup = etc/zfs/zed.d/zed.rc + source = git+https://github.com/openzfs/zfs.git + source = zfs-node-permission.conf + source = zfs.initcpio.install + source = zfs.initcpio.zfsencryptssh.install + source = zfs.initcpio.hook sha256sums = SKIP - sha256sums = 29a8a6d76fff01b71ef1990526785405d9c9410bdea417b08b56107210d00b10 - sha256sums = 78e038f95639c209576e7fa182afd56ac11a695af9ebfa958709839ff1e274ce - sha256sums = 29080a84e5d7e36e63c4412b98646043724621245b36e5288f5fed6914da5b68 + sha256sums = 7ad45fd291aa582639725f14d88d7da5bd3d427012b25bddbe917ca6d1a07c1a + sha256sums = 2f09c742287f4738c7c09a9669f8055cd63d3b9474cd1f6d9447152d11a1b913 + sha256sums = 93e6ac4e16f6b38b2fa397a63327bcf7001111e3a58eb5fb97c888098c932a51 + sha256sums = 15b5acea44225b4364ec6472a08d3d48666d241fe84c142e1171cd3b78a5584f + b2sums = SKIP + b2sums = 7eb3408b1354a4dd504000739101afc7ec0aed1afcdfa029552bf6989e9a8cd4a95b3d3563b3fb7902afa30a80fb01a3f5a2d5af82f9c734c48b5cc23aac25ca + b2sums = cb774227f157573f960bdb345e5b014c043a573c987d37a1db027b852d77a5eda1ee699612e1d8f4a2770897624889f1a3808116a171cc4c796a95e3caa43012 + b2sums = 04e2af875e194df393d6cff983efc3fdf02a03a745d1b0b1e4a745f873d910b4dd0a45db956c1b5b2d97e9d5bf724ef12e23f7a2be3d5c12be027eaccf42349a + b2sums = 779c864611249c3f21d1864508d60cfe5e0f5541d74fb3093c6bdfa56be2c76f386ac1690d363beaee491c5132f5f6dbc01553aa408cda579ebca74b0e0fd1d0 pkgname = zfs-utils-git - diff --git a/.gitignore b/.gitignore index b18b49395bde..c3e43b1da9f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -*.tar.xz -*.tar.gz -*.sig +zfs +src +pkg +*.pkg.* *.log -zfs/ @@ -1,65 +1,106 @@ -# Maintainer: Jan Houben <jan@nexttrex.de> -# Contributor: Jesus Alvarez <jeezusjr at gmail dot com> +# Maintainer: Yurii Kolesnykov <root@yurikoles.com> +# Contributor: Jonathon Fernyhough <jonathon"m2x+dev> +# Contributor: Eli Schwartz <eschwartz@archlinux.org> +# Contributor: Iacopo Isimbaldi <isiachi@rhye.it> # -# This PKGBUILD was generated by the archzfs build scripts located at +# Based on aur/zfs-utils by Kevin Stolp <kevinstolp@gmail.com> +# Based on archzfs/zfs-utils-git by Jan Houben <jan@nexttrex.de> # -# http://github.com/archzfs/archzfs +# PRs are welcome: https://github.com/yurikoles-aur/zfs-utils-git # -pkgname="zfs-utils-git" -_commit='e69bb31b71f60b338fa5510dc48de298f394ad73' -pkgver=2019.12.02.r5555.ge69bb31b7 +pkgname=zfs-utils-git +pkgver=2.2.99.r344.ga0635ae731 pkgrel=1 -pkgdesc="Kernel module support files for the Zettabyte File System." -makedepends=("python" "python-setuptools" "python-cffi" "git") -optdepends=("python: pyzfs and extra utilities", "python-cffi: pyzfs") -arch=("x86_64") -url="http://zfsonlinux.org/" -source=("git+https://github.com/zfsonlinux/zfs.git#commit=${_commit}" - "zfs-utils.initcpio.install" - "zfs-utils.initcpio.hook" - "zfs-utils.initcpio.zfsencryptssh.install") -sha256sums=("SKIP" - "29a8a6d76fff01b71ef1990526785405d9c9410bdea417b08b56107210d00b10" - "78e038f95639c209576e7fa182afd56ac11a695af9ebfa958709839ff1e274ce" - "29080a84e5d7e36e63c4412b98646043724621245b36e5288f5fed6914da5b68") -license=("CDDL") -groups=("archzfs-linux-git") -provides=("zfs-utils" "spl-utils") -install=zfs-utils.install -conflicts=("zfs-utils" "spl-utils") -replaces=("spl-utils-common-git" "zfs-utils-common-git") -backup=('etc/zfs/zed.d/zed.rc' 'etc/default/zfs' 'etc/modules-load.d/zfs.conf' 'etc/sudoers.d/zfs') +epoch=2 +pkgdesc="Userspace utilities for the Zettabyte File System." +arch=("i686" "x86_64" "aarch64") +url="https://zfsonlinux.org/" +license=('CDDL') +groups=('zfs-git') +makedepends=('python' 'python-setuptools' 'python-cffi' 'git') +optdepends=('python: pyzfs and extra utilities' 'python-cffi: pyzfs') +provides=("zfs-utils=${pkgver}") +conflicts=('zfs-utils') +backup=('etc/default/zfs' + 'etc/zfs/zed.d/zed.rc') +source=("git+https://github.com/openzfs/zfs.git" + "zfs-node-permission.conf" + "zfs.initcpio.install" + "zfs.initcpio.zfsencryptssh.install" + "zfs.initcpio.hook") +sha256sums=('SKIP' + '7ad45fd291aa582639725f14d88d7da5bd3d427012b25bddbe917ca6d1a07c1a' + '2f09c742287f4738c7c09a9669f8055cd63d3b9474cd1f6d9447152d11a1b913' + '93e6ac4e16f6b38b2fa397a63327bcf7001111e3a58eb5fb97c888098c932a51' + '15b5acea44225b4364ec6472a08d3d48666d241fe84c142e1171cd3b78a5584f') +b2sums=('SKIP' + '7eb3408b1354a4dd504000739101afc7ec0aed1afcdfa029552bf6989e9a8cd4a95b3d3563b3fb7902afa30a80fb01a3f5a2d5af82f9c734c48b5cc23aac25ca' + 'cb774227f157573f960bdb345e5b014c043a573c987d37a1db027b852d77a5eda1ee699612e1d8f4a2770897624889f1a3808116a171cc4c796a95e3caa43012' + '04e2af875e194df393d6cff983efc3fdf02a03a745d1b0b1e4a745f873d910b4dd0a45db956c1b5b2d97e9d5bf724ef12e23f7a2be3d5c12be027eaccf42349a' + '779c864611249c3f21d1864508d60cfe5e0f5541d74fb3093c6bdfa56be2c76f386ac1690d363beaee491c5132f5f6dbc01553aa408cda579ebca74b0e0fd1d0') + +pkgver() { + cd zfs + + git describe --long | sed 's/^zfs-//;s/-rc/rc/;s/\([^-]*-g\)/r\1/;s/-/./g' +} + +prepare() { + cd zfs -build() { - cd "${srcdir}/zfs" ./autogen.sh - ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --with-mounthelperdir=/usr/bin \ - --libdir=/usr/lib --datadir=/usr/share --includedir=/usr/include \ - --with-udevdir=/lib/udev --libexecdir=/usr/lib/zfs-${pkgver} \ - --with-config=user --enable-systemd --enable-pyzfs +} + +build() { + # Disable tree vectorization. Related issues: + # https://github.com/openzfs/zfs/issues/13605 + # https://github.com/openzfs/zfs/issues/13620 + export CFLAGS="$CFLAGS -fno-tree-vectorize" + export CXXFLAGS="$CXXFLAGS -fno-tree-vectorize" + + cd zfs + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --sbindir=/usr/bin \ + --with-mounthelperdir=/usr/bin \ + --libdir=/usr/lib \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --with-udevdir=/usr/lib/udev \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --enable-pyzfz \ + --enable-systemd \ + --with-zfsexecdir=/usr/lib/zfs \ + --with-config=user make } package() { - cd "${srcdir}/zfs" + cd zfs + make DESTDIR="${pkgdir}" install + install -D -m644 contrib/bash_completion.d/zfs "${pkgdir}"/usr/share/bash-completion/completions/zfs + + # Fix for permissions being overwritten on /dev/zfs. Related issues: + # https://github.com/openzfs/zfs/issues/15146 + # https://github.com/systemd/systemd/issues/28653 + install -D -m644 "${srcdir}"/zfs-node-permission.conf "${pkgdir}"/usr/lib/tmpfiles.d/zfs-node-permission.conf + # Remove uneeded files rm -r "${pkgdir}"/etc/init.d - rm -r "${pkgdir}"/usr/share/initramfs-tools rm -r "${pkgdir}"/usr/lib/modules-load.d - # move module tree /lib -> /usr/lib - cp -r "${pkgdir}"/{lib,usr} - rm -r "${pkgdir}"/lib - # Autoload the zfs module at boot - mkdir -p "${pkgdir}/etc/modules-load.d" - printf "%s\n" "zfs" > "${pkgdir}/etc/modules-load.d/zfs.conf" + rm -r "${pkgdir}"/usr/share/initramfs-tools + rm -r "${pkgdir}"/usr/share/zfs/*.sh + rm -r "${pkgdir}"/usr/share/zfs/{runfiles,test-runner,zfs-tests} # fix permissions chmod 750 ${pkgdir}/etc/sudoers.d chmod 440 ${pkgdir}/etc/sudoers.d/zfs + # Install the support files - install -D -m644 "${srcdir}"/zfs-utils.initcpio.hook "${pkgdir}"/usr/lib/initcpio/hooks/zfs - install -D -m644 "${srcdir}"/zfs-utils.initcpio.install "${pkgdir}"/usr/lib/initcpio/install/zfs - install -D -m644 "${srcdir}"/zfs-utils.initcpio.zfsencryptssh.install "${pkgdir}"/usr/lib/initcpio/install/zfsencryptssh - install -D -m644 contrib/bash_completion.d/zfs "${pkgdir}"/usr/share/bash-completion/completions/zfs + install -D -m644 "${srcdir}"/zfs.initcpio.hook "${pkgdir}"/usr/lib/initcpio/hooks/zfs + install -D -m644 "${srcdir}"/zfs.initcpio.install "${pkgdir}"/usr/lib/initcpio/install/zfs + install -D -m644 "${srcdir}"/zfs.initcpio.zfsencryptssh.install "${pkgdir}"/usr/lib/initcpio/install/zfsencryptssh } diff --git a/zfs-node-permission.conf b/zfs-node-permission.conf new file mode 100644 index 000000000000..359fb7862218 --- /dev/null +++ b/zfs-node-permission.conf @@ -0,0 +1 @@ +z /dev/zfs 0666 - - diff --git a/zfs-utils.install b/zfs-utils.install deleted file mode 100644 index 914ed46bf477..000000000000 --- a/zfs-utils.install +++ /dev/null @@ -1,18 +0,0 @@ -post_upgrade() { - - # If upgrading from 2017.12.08.r3208.4e9b15696-1 or older - # display zfs-import warning - if [[ $(vercmp $2 2017.12.08.r3208.4e9b15696-1) -le 0 ]]; then - echo '>>> WARNING: A new systemd unit file was added to archzfs!' - echo '>>> You may need enable zfs-import.target' - echo '>>> See https://github.com/archzfs/archzfs/issues/186' - fi - - # If upgrading from 2018.02.02.r3272.1b66810ba-1 or older - # display encryption format change warning - if [[ $(vercmp $2 2018.02.02.r3272.1b66810ba-1) -le 0 ]]; then - echo '>>> WARNING: The on-disk format for encrypted datasets has changed!' - echo '>>> All encrypted datasets will mount read only and need to be migrated.' - echo '>>> See https://github.com/archzfs/archzfs/issues/222' - fi -} diff --git a/zfs-utils.initcpio.hook b/zfs.initcpio.hook index b75d2fa17961..4770c08e14ce 100644 --- a/zfs-utils.initcpio.hook +++ b/zfs.initcpio.hook @@ -6,6 +6,7 @@ # ZPOOL_FORCE="" ZPOOL_IMPORT_FLAGS="" +ZFS_BOOT_ONLY="" zfs_get_bootfs () { for zfs_dataset in $(zpool list -H -o bootfs); do @@ -28,24 +29,67 @@ zfs_get_bootfs () { zfs_decrypt_fs() { dataset=$1 - # check if 'zfs load-key' is available - zfs 2>&1 | grep load-key > /dev/null || return 0 + # Make sure dataset is encrypted; get fails if ZFS does not support encryption + encryption="$(zfs get -H -o value encryption "${dataset}" 2>/dev/null)" || return 0 + [ "${encryption}" != "off" ] || return 0 - # check if dataset is encrypted - [ "$(zfs get -H -o value encryption "${dataset}")" != "off" ] || return 0 + # Make sure the dataset is locked + keystatus="$(zfs get -H -o value keystatus "${dataset}")" || return 0 + [ "${keystatus}" != "available" ] || return 0 - # check if key is already loaded - [ "$(zfs get -H -o value keystatus "${dataset}")" != "available" ] || return 0 + # Make sure the encryptionroot is sensible + encryptionroot="$(zfs get -H -o value encryptionroot "${dataset}")" || return 0 + [ "${encryptionroot}" != "-" ] || return 0 - # get the encryption root - encryptionroot=$(zfs get -H -o value encryptionroot "${dataset}") - - # export encription root to be used by other hooks (SSH) + # Export encryption root to be used by other hooks (SSH) echo "${encryptionroot}" > /.encryptionroot - # loop until we get the correct password or key is unlocked by another vector (SSH for instance) - while [ "$(zfs get -H -o value keystatus "${encryptionroot}")" != "available" ] && - ! eval zfs load-key "${encryptionroot}"; do + prompt_override="" + if keylocation="$(zfs get -H -o value keylocation "${encryptionroot}")"; then + # If key location is a file, determine if it can by overridden by prompt + if [ "${keylocation}" != "prompt" ]; then + if keyformat="$(zfs get -H -o value keyformat "${encryptionroot}")"; then + [ "${keyformat}" = "passphrase" ] && prompt_override="yes" + fi + fi + + # If key location is a local file, check if file exists + if [ "${keylocation%%://*}" = "file" ]; then + keyfile="${keylocation#file://}" + + # If file not yet exist, wait for udev to create device nodes + if [ ! -r "${keyfile}" ]; then + udevadm settle + + # Wait for udev up to 10 seconds + if [ ! -r "${keyfile}" ]; then + echo "Waiting for key ${keyfile} for ${encryptionroot}..." + for _ in $(seq 1 20); do + sleep 0.5s + [ -r "${keyfile}" ] && break + done + fi + + if [ ! -r "${keyfile}" ]; then + echo "Key ${keyfile} for ${encryptionroot} hasn't appeared. Trying anyway." + fi + fi + fi + fi + + # Loop until key is loaded here or by another vector (SSH, for instance) + while [ "$(zfs get -H -o value keystatus "${encryptionroot}")" != "available" ]; do + # Try the default loading mechanism + zfs load-key "${encryptionroot}" && break + + # Load failed, try a prompt if the failure was not a prompt + if [ -n "${prompt_override}" ]; then + echo "Unable to load key ${keylocation}; please type the passphrase" + echo "To retry the file, interrupt now or repeatedly input a wrong passphrase" + zfs load-key -L prompt "${encryptionroot}" && break + fi + + # Throttle retry attempts sleep 2 done @@ -69,7 +113,7 @@ zfs_mount_handler () { local pool="${ZFS_DATASET%%/*}" local rwopt_exp="${rwopt:-ro}" - if ! zpool list -H "${pool}" 2>1 > /dev/null ; then + if ! zpool list -H "${pool}" > /dev/null 2>&1; then if [ ! "${rwopt_exp}" = "rw" ]; then msg "ZFS: Importing pool ${pool} readonly." ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -o readonly=on" @@ -85,7 +129,7 @@ zfs_mount_handler () { local node="$1" local rootmnt=$(zfs get -H -o value mountpoint "${ZFS_DATASET}") - local tab_file="${node}/etc/fstab" + local tab_file="/etc/fstab" local zfs_datasets="$(zfs list -H -o name -t filesystem -r ${ZFS_DATASET})" # Mount the root, and any child datasets @@ -93,7 +137,7 @@ zfs_mount_handler () { mountpoint=$(zfs get -H -o value mountpoint "${dataset}") canmount=$(zfs get -H -o value canmount "${dataset}") # skip dataset - [ ${canmount} = "off" -o ${mountpoint} = "none" ] && continue + [ ${dataset} != "${ZFS_DATASET}" -a \( ${canmount} = "off" -o ${canmount} = "noauto" -o ${mountpoint} = "none" \) ] && continue if [ ${mountpoint} = "legacy" ]; then if [ -f "${tab_file}" ]; then if findmnt -snero source -F "${tab_file}" -S "${dataset}" > /dev/null 2>&1; then @@ -114,6 +158,9 @@ set_flags() { # Force import the pools, useful if the pool has not properly been exported using 'zpool export <pool>' [ ! "${zfs_force}" = "" ] && ZPOOL_FORCE="-f" + # Disable late hook, useful if we want to use zfs-import-cache.service instead + [ ! "${zfs_boot_only}" = "" ] && ZFS_BOOT_ONLY="1" + # Add import directory to import command flags [ ! "${zfs_import_dir}" = "" ] && ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -d ${zfs_import_dir}" [ "${zfs_import_dir}" = "" ] && [ -f /etc/zfs/zpool.cache.org ] && ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -c /etc/zfs/zpool.cache.org" @@ -128,6 +175,7 @@ run_hook() { case ${root} in # root=zfs "zfs") + ZFS_DATASET="bootfs" mount_handler="zfs_mount_handler" ;; # root=ZFS=... syntax (grub) @@ -182,8 +230,8 @@ run_hook() { run_latehook () { set_flags - # only run zpool import, if flags were set (cache file found / zfs_import_dir specified) - [ ! "${ZPOOL_IMPORT_FLAGS}" = "" ] && zpool import ${ZPOOL_IMPORT_FLAGS} -N -a ${ZPOOL_FORCE} + # only run zpool import, if flags were set (cache file found / zfs_import_dir specified) and zfs_boot_only is not set + [ ! "${ZPOOL_IMPORT_FLAGS}" = "" ] && [ "${ZFS_BOOT_ONLY}" = "" ] && zpool import ${ZPOOL_IMPORT_FLAGS} -N -a ${ZPOOL_FORCE} } # vim:set ts=4 sw=4 ft=sh et: diff --git a/zfs-utils.initcpio.install b/zfs.initcpio.install index 350377b0d58c..27e11f587152 100644 --- a/zfs-utils.initcpio.install +++ b/zfs.initcpio.install @@ -22,7 +22,8 @@ build() { zstreamdump \ /lib/udev/vdev_id \ /lib/udev/zvol_id \ - findmnt + findmnt \ + udevadm map add_file \ /lib/udev/rules.d/60-zvol.rules \ @@ -40,6 +41,8 @@ build() { [[ -f /etc/zfs/zpool.cache ]] && cp "/etc/zfs/zpool.cache" "${BUILDROOT}/etc/zfs/zpool.cache.org" [[ -f /etc/modprobe.d/zfs.conf ]] && add_file "/etc/modprobe.d/zfs.conf" + [[ -f /etc/hostid ]] && add_file "/etc/hostid" + [[ -f /etc/fstab ]] && add_file "/etc/fstab" } help() { diff --git a/zfs-utils.initcpio.zfsencryptssh.install b/zfs.initcpio.zfsencryptssh.install index e0ef04beabfe..f724eeec5663 100644 --- a/zfs-utils.initcpio.zfsencryptssh.install +++ b/zfs.initcpio.zfsencryptssh.install @@ -1,7 +1,7 @@ #!/bin/bash make_etc_passwd() { - echo 'root:x:0:0:root:/root:/bin/zfsdecrypt_shell' > "${BUILDROOT}"/etc/passwd + echo 'root:x:0:0:root:/root:/bin/zfsdecrypt_shell' >> "${BUILDROOT}"/etc/passwd echo '/bin/zfsdecrypt_shell' > "${BUILDROOT}"/etc/shells } |