summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Schwartz2020-03-18 15:48:04 -0400
committerEli Schwartz2020-04-02 12:14:55 -0400
commitafd1d3e734eda168996aca8752f51b1416023e45 (patch)
tree660228a0f93491c5b1c357ac295857b7f654ef31
parentd8a199382b16c6455d35389dc6547301f817ca8c (diff)
downloadaur-afd1d3e734eda168996aca8752f51b1416023e45.tar.gz
upgpkg: zfs-utils-git 0.8.0.r709.g5a42ef04f-1
This package is atrocious and completely unacceptable as-is. It claims to be a git package, but uses pinned sources, and the packager has simply ignored this for 15 months now. The version number is honestly bonkers, it distributes tons of garbage, and it's full of pseudocode from archzfs's questionable maintenance scripts. Nuke it all and replace it with parallel code from zfs-dkms.
-rw-r--r--.SRCINFO41
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD118
-rw-r--r--zfs-utils.initcpio.hook189
-rw-r--r--zfs-utils.initcpio.zfsencryptssh.install39
-rw-r--r--zfs-utils.install18
-rw-r--r--zfs.initcpio.hook119
-rw-r--r--zfs.initcpio.install (renamed from zfs-utils.initcpio.install)3
8 files changed, 202 insertions, 330 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 6ffde7ec9b10..9605c56ecfc4 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,36 +1,25 @@
pkgbase = zfs-utils-git
- pkgdesc = Kernel module support files for the Zettabyte File System.
- pkgver = 2020.03.31.r5836.g0929c4de3
+ pkgdesc = Userspace utilities for the Zettabyte File System.
+ pkgver = 0.8.0.r709.g5a42ef04f
pkgrel = 1
- url = http://zfsonlinux.org/
- install = zfs-utils.install
+ epoch = 1
+ url = https://zfsonlinux.org/
+ arch = i686
arch = x86_64
- groups = archzfs-linux-git
license = CDDL
- makedepends = python
- makedepends = python-setuptools
- makedepends = python-cffi
makedepends = git
- optdepends = python: pyzfs and extra utilities,
- optdepends = python-cffi: pyzfs
- provides = zfs-utils
- provides = spl-utils
+ optdepends = python: for arcstat/arc_summary/dbufstat
+ provides = zfs-utils=0.8.0.r709.g5a42ef04f
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=0929c4de398606f8305057ca540cf577e6771c30
- source = zfs-utils.initcpio.install
- source = zfs-utils.initcpio.hook
- source = zfs-utils.initcpio.zfsencryptssh.install
+ source = git+https://github.com/zfsonlinux/zfs.git
+ source = zfs.initcpio.install
+ source = zfs.initcpio.hook
sha256sums = SKIP
- sha256sums = 29a8a6d76fff01b71ef1990526785405d9c9410bdea417b08b56107210d00b10
- sha256sums = 78e038f95639c209576e7fa182afd56ac11a695af9ebfa958709839ff1e274ce
- sha256sums = 29080a84e5d7e36e63c4412b98646043724621245b36e5288f5fed6914da5b68
+ sha256sums = da1cdc045d144d2109ec7b5d97c53a69823759d8ecff410e47c3a66b69e6518d
+ sha256sums = f95ad1a5421ccbb8b01f448373f46cfd1f718361a82c2687a597325cf9827e3e
+ b2sums = SKIP
+ b2sums = 570e995bba07ea0fb424dff191180b8017b6469501964dc0b70fd51e338a4dad260f87cc313489866cbfd1583e4aac2522cf7309c067cc5314eb83c37fe14ff3
+ b2sums = 491a7f20b0c6b4ce4fcedab617b2d7a4f2a01f1bc8f1ae57efde2fb22c2ab09a1107a8f4877b95c27576fe4216d01f181936787f51ce532bb13c5806badf7519
pkgname = zfs-utils-git
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index b18b49395bde..000000000000
--- a/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-*.tar.xz
-*.tar.gz
-*.sig
-*.log
-zfs/
diff --git a/PKGBUILD b/PKGBUILD
index 1dad703d0355..3ca35d10d4e6 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,65 +1,79 @@
-# Maintainer: Jan Houben <jan@nexttrex.de>
-# Contributor: Jesus Alvarez <jeezusjr at gmail dot com>
-#
-# This PKGBUILD was generated by the archzfs build scripts located at
-#
-# http://github.com/archzfs/archzfs
-#
-pkgname="zfs-utils-git"
-_commit='0929c4de398606f8305057ca540cf577e6771c30'
+# Maintainer: Eli Schwartz <eschwartz@archlinux.org>
+# Contributor: Iacopo Isimbaldi <isiachi@rhye.it>
-pkgver=2020.03.31.r5836.g0929c4de3
+# All my PKGBUILDs are managed at https://github.com/eli-schwartz/pkgbuilds
+
+pkgname=zfs-utils-git
+pkgver=0.8.0.r709.g5a42ef04f
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=1
+pkgdesc="Userspace utilities for the Zettabyte File System."
+arch=("i686" "x86_64")
+url="https://zfsonlinux.org/"
+license=('CDDL')
+optdepends=('python: for arcstat/arc_summary/dbufstat')
+makedepends=('git')
+conflicts=("${pkgname%-git}")
+provides=("${pkgname%-git}=${pkgver}")
+source=("git+https://github.com/zfsonlinux/zfs.git"
+ "zfs.initcpio.install"
+ "zfs.initcpio.hook")
+sha256sums=('SKIP'
+ 'da1cdc045d144d2109ec7b5d97c53a69823759d8ecff410e47c3a66b69e6518d'
+ 'f95ad1a5421ccbb8b01f448373f46cfd1f718361a82c2687a597325cf9827e3e')
+b2sums=('SKIP'
+ '570e995bba07ea0fb424dff191180b8017b6469501964dc0b70fd51e338a4dad260f87cc313489866cbfd1583e4aac2522cf7309c067cc5314eb83c37fe14ff3'
+ '491a7f20b0c6b4ce4fcedab617b2d7a4f2a01f1bc8f1ae57efde2fb22c2ab09a1107a8f4877b95c27576fe4216d01f181936787f51ce532bb13c5806badf7519')
+
+pkgver() {
+ cd "${srcdir}"/zfs
+
+ git describe --long | sed 's/^zfs-//;s/\([^-]*-g\)/r\1/;s/-/./g'
+
+}
+
+prepare() {
+ cd "${srcdir}"/zfs
+
+ # pyzfs is not built, but build system tries to check for python anyway
+ ln -sf /bin/true python3-fake
+
+ autoreconf -fi
+}
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
+ cd "${srcdir}"/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/zfs \
+ --with-python="$PWD/python3-fake" \
+ --enable-pyzfs=no \
+ --with-config=user
make
}
package() {
- cd "${srcdir}/zfs"
+ cd "${srcdir}"/zfs
+
make DESTDIR="${pkgdir}" install
+ install -D -m644 contrib/bash_completion.d/zfs "${pkgdir}"/usr/share/bash-completion/completions/zfs
+
# Remove uneeded files
rm -r "${pkgdir}"/etc/init.d
- rm -r "${pkgdir}"/usr/share/initramfs-tools
+ rm -r "${pkgdir}"/etc/sudoers.d #???
+ # We're experimenting with dracut in [extra], so start installing this.
+ #rm -r "${pkgdir}"/usr/lib/dracut
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"
- # 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
+ rm -r "${pkgdir}"/usr/share/initramfs-tools
+ rm -r "${pkgdir}"/usr/share/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
}
diff --git a/zfs-utils.initcpio.hook b/zfs-utils.initcpio.hook
deleted file mode 100644
index b75d2fa17961..000000000000
--- a/zfs-utils.initcpio.hook
+++ /dev/null
@@ -1,189 +0,0 @@
-#
-# WARNING: This script is parsed by ash in busybox at boot time, not bash!
-# http://linux.die.net/man/1/ash
-# https://wiki.ubuntu.com/DashAsBinSh
-# http://www.jpsdomain.org/public/2008-JP_bash_vs_dash.pdf
-#
-ZPOOL_FORCE=""
-ZPOOL_IMPORT_FLAGS=""
-
-zfs_get_bootfs () {
- for zfs_dataset in $(zpool list -H -o bootfs); do
- case ${zfs_dataset} in
- "" | "-")
- # skip this line/dataset
- ;;
- "no pools available")
- return 1
- ;;
- *)
- ZFS_DATASET=${zfs_dataset}
- return 0
- ;;
- esac
- done
- return 1
-}
-
-zfs_decrypt_fs() {
- dataset=$1
-
- # check if 'zfs load-key' is available
- zfs 2>&1 | grep load-key > /dev/null || return 0
-
- # check if dataset is encrypted
- [ "$(zfs get -H -o value encryption "${dataset}")" != "off" ] || return 0
-
- # check if key is already loaded
- [ "$(zfs get -H -o value keystatus "${dataset}")" != "available" ] || return 0
-
- # get the encryption root
- encryptionroot=$(zfs get -H -o value encryptionroot "${dataset}")
-
- # export encription 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
- sleep 2
- done
-
- if [ -f /.encryptionroot ]; then
- rm /.encryptionroot
- fi
-}
-
-zfs_mount_handler () {
- if [ "${ZFS_DATASET}" = "bootfs" ] ; then
- if ! zfs_get_bootfs ; then
- # Lets import everything and try again
- zpool import ${ZPOOL_IMPORT_FLAGS} -N -a ${ZPOOL_FORCE}
- if ! zfs_get_bootfs ; then
- err "ZFS: Cannot find bootfs."
- exit 1
- fi
- fi
- fi
-
- local pool="${ZFS_DATASET%%/*}"
- local rwopt_exp="${rwopt:-ro}"
-
- if ! zpool list -H "${pool}" 2>1 > /dev/null ; then
- if [ ! "${rwopt_exp}" = "rw" ]; then
- msg "ZFS: Importing pool ${pool} readonly."
- ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -o readonly=on"
- else
- msg "ZFS: Importing pool ${pool}."
- fi
-
- if ! zpool import ${ZPOOL_IMPORT_FLAGS} -N "${pool}" ${ZPOOL_FORCE} ; then
- err "ZFS: Unable to import pool ${pool}."
- exit 1
- fi
- fi
-
- local node="$1"
- local rootmnt=$(zfs get -H -o value mountpoint "${ZFS_DATASET}")
- local tab_file="${node}/etc/fstab"
- local zfs_datasets="$(zfs list -H -o name -t filesystem -r ${ZFS_DATASET})"
-
- # Mount the root, and any child datasets
- for dataset in ${zfs_datasets}; do
- mountpoint=$(zfs get -H -o value mountpoint "${dataset}")
- canmount=$(zfs get -H -o value canmount "${dataset}")
- # skip dataset
- [ ${canmount} = "off" -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
- opt=$(findmnt -snero options -F "${tab_file}" -S "${dataset}")
- mnt=$(findmnt -snero target -F "${tab_file}" -S "${dataset}")
- zfs_decrypt_fs "${dataset}"
- mount -t zfs -o "${opt}" "${dataset}" "${node}${mnt}"
- fi
- fi
- else
- zfs_decrypt_fs "${dataset}"
- mount -t zfs -o "zfsutil,${rwopt_exp}" "${dataset}" "${node}/${mountpoint##${rootmnt}}"
- fi
- done
-}
-
-set_flags() {
- # Force import the pools, useful if the pool has not properly been exported using 'zpool export <pool>'
- [ ! "${zfs_force}" = "" ] && ZPOOL_FORCE="-f"
-
- # 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"
-}
-
-run_hook() {
- set_flags
-
- # Wait 15 seconds for ZFS devices to show up
- [ "${zfs_wait}" = "" ] && ZFS_WAIT="15" || ZFS_WAIT="${zfs_wait}"
-
- case ${root} in
- # root=zfs
- "zfs")
- mount_handler="zfs_mount_handler"
- ;;
- # root=ZFS=... syntax (grub)
- "ZFS="*)
- mount_handler="zfs_mount_handler"
- ZFS_DATASET="${root#*[=]}"
- ;;
- esac
-
- case ${zfs} in
- "")
- # skip this line/dataset
- ;;
- auto|bootfs)
- ZFS_DATASET="bootfs"
- mount_handler="zfs_mount_handler"
- local pool="[a-zA-Z][^ ]*"
- ;;
- *)
- ZFS_DATASET="${zfs}"
- mount_handler="zfs_mount_handler"
- local pool="${ZFS_DATASET%%/*}"
- ;;
- esac
-
- # Allow at least n seconds for zfs device to show up. Especially
- # when using zfs_import_dir instead of zpool.cache, the listing of
- # available pools can be slow, so this loop must be top-tested to
- # ensure we do one 'zpool import' pass after the timer has expired.
- sleep ${ZFS_WAIT} & pid=$!
- local break_after=0
- while :; do
- kill -0 $pid > /dev/null 2>&1 || break_after=1
- if [ -c "/dev/zfs" ]; then
- zpool import ${ZPOOL_IMPORT_FLAGS} | awk "
- BEGIN { pool_found=0; online=0; unavail=0 }
- /^ ${pool} .*/ { pool_found=1 }
- /^\$/ { pool_found=0 }
- /UNAVAIL/ { if (pool_found == 1) { unavail=1 } }
- /ONLINE/ { if (pool_found == 1) { online=1 } }
- END { if (online == 1 && unavail != 1)
- { exit 0 }
- else
- { exit 1 }
- }" && break
- fi
- [ $break_after == 1 ] && break
- sleep 1
- done
- kill $pid > /dev/null 2>&1
-}
-
-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}
-}
-
-# vim:set ts=4 sw=4 ft=sh et:
diff --git a/zfs-utils.initcpio.zfsencryptssh.install b/zfs-utils.initcpio.zfsencryptssh.install
deleted file mode 100644
index e0ef04beabfe..000000000000
--- a/zfs-utils.initcpio.zfsencryptssh.install
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-make_etc_passwd() {
- echo 'root:x:0:0:root:/root:/bin/zfsdecrypt_shell' > "${BUILDROOT}"/etc/passwd
- echo '/bin/zfsdecrypt_shell' > "${BUILDROOT}"/etc/shells
-}
-
-make_zfsdecrypt_shell() {
- decrypt_shell='#!/bin/sh
-if [ -f "/.encryptionroot" ]; then
- # source zfs hook functions
- . /hooks/zfs
- # decrypt bootfs
- zfs_decrypt_fs "$(cat /.encryptionroot)"
- # kill pending decryption attempt to allow the boot process to continue
- killall zfs
-else
- echo "ZFS is not ready yet. Please wait!"
-fi'
- printf '%s' "$decrypt_shell" > "${BUILDROOT}"/bin/zfsdecrypt_shell
- chmod a+x "${BUILDROOT}"/bin/zfsdecrypt_shell
-}
-
-build ()
-{
- make_etc_passwd
- make_zfsdecrypt_shell
-}
-
-help ()
-{
- cat<<HELPEOF
-This hook is meant to be used in conjunction with mkinitcpio-dropbear,
-mkinitcpio-netconf and/ormkinitcpio-ppp. This will provide a way to unlock
-your encrypted ZFS root filesystem remotely.
-HELPEOF
-}
-
-# vim: set ts=4 sw=4 ft=sh et:
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.initcpio.hook b/zfs.initcpio.hook
new file mode 100644
index 000000000000..7288ab8018b3
--- /dev/null
+++ b/zfs.initcpio.hook
@@ -0,0 +1,119 @@
+#
+# WARNING: This script is parsed by ash in busybox at boot time, not bash!
+# http://linux.die.net/man/1/ash
+# https://wiki.ubuntu.com/DashAsBinSh
+# http://www.jpsdomain.org/public/2008-JP_bash_vs_dash.pdf
+#
+ZPOOL_FORCE=""
+ZPOOL_IMPORT_FLAGS=""
+
+zfs_get_bootfs () {
+ for zfs_dataset in $(zpool list -H -o bootfs); do
+ case ${zfs_dataset} in
+ "" | "-")
+ # skip this line/dataset
+ ;;
+ "no pools available")
+ return 1
+ ;;
+ *)
+ ZFS_DATASET=${zfs_dataset}
+ return 0
+ ;;
+ esac
+ done
+ return 1
+}
+
+zfs_mount_handler () {
+ if [ "${ZFS_DATASET}" = "bootfs" ] ; then
+ if ! zfs_get_bootfs ; then
+ # Lets import everything and try again
+ zpool import ${ZPOOL_IMPORT_FLAGS} -N -a ${ZPOOL_FORCE}
+ if ! zfs_get_bootfs ; then
+ die "ZFS: Cannot find bootfs."
+ fi
+ fi
+ fi
+
+ local pool="${ZFS_DATASET%%/*}"
+ local rwopt_exp="${rwopt:-ro}"
+
+ if ! zpool list -H "${pool}" 2>&1 > /dev/null ; then
+ if [ ! "${rwopt_exp}" = "rw" ]; then
+ msg "ZFS: Importing pool ${pool} readonly."
+ ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -o readonly=on"
+ else
+ msg "ZFS: Importing pool ${pool}."
+ fi
+
+ if ! zpool import ${ZPOOL_IMPORT_FLAGS} -N "${pool}" ${ZPOOL_FORCE} ; then
+ die "ZFS: Unable to import pool ${pool}."
+ fi
+ fi
+
+ local node="$1"
+ local tab_file="${node}/etc/fstab"
+ local zfs_datasets="$(zfs list -H -o name -t filesystem -r ${ZFS_DATASET})"
+
+ # Mount the root, and any child datasets
+ for dataset in ${zfs_datasets}; do
+ mountpoint=$(zfs get -H -o value mountpoint "${dataset}")
+ case ${mountpoint} in
+ "none")
+ # skip this line/dataset.
+ ;;
+ "legacy")
+ if [ -f "${tab_file}" ]; then
+ if findmnt -snero source -F "${tab_file}" -S "${dataset}" > /dev/null 2>&1; then
+ opt=$(findmnt -snero options -F "${tab_file}" -S "${dataset}")
+ mnt=$(findmnt -snero target -F "${tab_file}" -S "${dataset}")
+ mount -t zfs -o "${opt}" "${dataset}" "${node}${mnt}"
+ fi
+ fi
+ ;;
+ *)
+ mount -t zfs -o "zfsutil,${rwopt_exp}" "${dataset}" "${node}${mountpoint}"
+ ;;
+ esac
+ done
+}
+
+run_hook() {
+ # Force import the pools, useful if the pool has not properly been exported using 'zpool export <pool>'
+ [ ! "${zfs_force}" = "" ] && ZPOOL_FORCE="-f"
+
+ # Add import directory to import command flags
+ [ ! "${zfs_import_dir}" = "" ] && ZPOOL_IMPORT_FLAGS="${ZPOOL_IMPORT_FLAGS} -d ${zfs_import_dir}"
+
+ # Wait 15 seconds for ZFS devices to show up
+ [ "${zfs_wait}" = "" ] && ZFS_WAIT="15" || ZFS_WAIT="${zfs_wait}"
+
+ [ "${root}" = "zfs" ] && mount_handler="zfs_mount_handler"
+
+ case ${zfs} in
+ "")
+ # skip this line/dataset
+ ;;
+ auto|bootfs)
+ ZFS_DATASET="bootfs"
+ mount_handler="zfs_mount_handler"
+ ;;
+ *)
+ ZFS_DATASET="${zfs}"
+ mount_handler="zfs_mount_handler"
+ ;;
+ esac
+
+ # Allow up to n seconds for zfs device to show up
+ for i in $(seq 1 ${ZFS_WAIT}); do
+ [ -c "/dev/zfs" ] && break
+ sleep 1
+ done
+}
+
+run_latehook () {
+ zpool import -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..589b46bee544 100644
--- a/zfs-utils.initcpio.install
+++ b/zfs.initcpio.install
@@ -38,8 +38,9 @@ build() {
# allow mount(8) to "autodetect" ZFS
echo 'zfs' >>"${BUILDROOT}/etc/filesystems"
- [[ -f /etc/zfs/zpool.cache ]] && cp "/etc/zfs/zpool.cache" "${BUILDROOT}/etc/zfs/zpool.cache.org"
+ [[ -f /etc/zfs/zpool.cache ]] && add_file "/etc/zfs/zpool.cache"
[[ -f /etc/modprobe.d/zfs.conf ]] && add_file "/etc/modprobe.d/zfs.conf"
+ [[ -f /etc/hostid ]] && add_file "/etc/hostid"
}
help() {