commit:     25f80a2eafbe1eae88d053b507ee7200f31c42dc
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  1 07:33:01 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul  1 07:34:38 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25f80a2e

sys-fs/zfs: more Dracut fixes

- Backport the merged version of non-root fix (one we used should be fine,
but upstream went with another)

- Revert commit which breaks dist-kernel initramfs building (breaks
with USE=initramfs on gentoo-kernel b/c zfs isn't yet rebuilt when
gentoo-kernel's pkg_postinst builds dracut).

Bug: https://github.com/openzfs/zfs/issues/13595
Bug: https://bugs.gentoo.org/854333
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-fs/zfs/files/2.1.5-dracut-zfs-missing.patch    | 14 +++++
 sys-fs/zfs/files/2.1.5-r2-dracut-non-root.patch    | 60 ++++++++++++++++++++++
 .../zfs/{zfs-9999.ebuild => zfs-2.1.5-r2.ebuild}   |  9 ++++
 sys-fs/zfs/zfs-9999.ebuild                         |  4 ++
 4 files changed, 87 insertions(+)

diff --git a/sys-fs/zfs/files/2.1.5-dracut-zfs-missing.patch 
b/sys-fs/zfs/files/2.1.5-dracut-zfs-missing.patch
new file mode 100644
index 000000000000..077bcd55f6d5
--- /dev/null
+++ b/sys-fs/zfs/files/2.1.5-dracut-zfs-missing.patch
@@ -0,0 +1,14 @@
+https://github.com/openzfs/zfs/commit/ebbfc6cb853d2d2f3f0671362d5ff5588be39e9d
+https://github.com/openzfs/zfs/issues/13595
+--- b/contrib/dracut/90zfs/module-setup.sh.in
++++ a/contrib/dracut/90zfs/module-setup.sh.in
+@@ -19,7 +19,7 @@
+ }
+ 
+ installkernel() {
++      instmods zfs
+-      instmods -c zfs
+ }
+ 
+ install() {
+

diff --git a/sys-fs/zfs/files/2.1.5-r2-dracut-non-root.patch 
b/sys-fs/zfs/files/2.1.5-r2-dracut-non-root.patch
new file mode 100644
index 000000000000..a9c6130f5b00
--- /dev/null
+++ b/sys-fs/zfs/files/2.1.5-r2-dracut-non-root.patch
@@ -0,0 +1,60 @@
+https://github.com/openzfs/zfs/commit/eefe83eaa68f7cb4a49c580dd940d3688e42c849
+https://bugs.gentoo.org/854333
+
+From eefe83eaa68f7cb4a49c580dd940d3688e42c849 Mon Sep 17 00:00:00 2001
+From: Toyam Cox <[email protected]>
+Date: Thu, 30 Jun 2022 13:47:58 -0400
+Subject: [PATCH] dracut: fix boot on non-zfs-root systems
+
+Simply prevent overwriting root until it needs to be overwritten.
+
+Dracut could change this value before this module is called, but won't
+change the kernel command line.
+
+Reviewed-by: Andrew J. Hesford <[email protected]>
+Signed-off-by: Toyam Cox <[email protected]>
+Closes #13592
+---
+ contrib/dracut/90zfs/zfs-lib.sh.in | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/contrib/dracut/90zfs/zfs-lib.sh.in 
b/contrib/dracut/90zfs/zfs-lib.sh.in
+index e44673c2d75..3a43e514d6f 100755
+--- a/contrib/dracut/90zfs/zfs-lib.sh.in
++++ b/contrib/dracut/90zfs/zfs-lib.sh.in
+@@ -88,11 +88,11 @@ decode_root_args() {
+         return
+     fi
+ 
+-    root=$(getarg root=)
++    xroot=$(getarg root=)
+     rootfstype=$(getarg rootfstype=)
+ 
+     # shellcheck disable=SC2249
+-    case "$root" in
++    case "$xroot" in
+         ""|zfs|zfs:|zfs:AUTO)
+             root=zfs:AUTO
+             rootfstype=zfs
+@@ -100,7 +100,7 @@ decode_root_args() {
+             ;;
+ 
+         ZFS=*|zfs:*)
+-            root="${root#zfs:}"
++            root="${xroot#zfs:}"
+             root="${root#ZFS=}"
+             root=$(echo "$root" | tr '+' ' ')
+             rootfstype=zfs
+@@ -109,9 +109,9 @@ decode_root_args() {
+     esac
+ 
+     if [ "$rootfstype" = "zfs" ]; then
+-        case "$root" in
++        case "$xroot" in
+             "") root=zfs:AUTO ;;
+-            *)  root=$(echo "$root" | tr '+' ' ') ;;
++            *)  root=$(echo "$xroot" | tr '+' ' ') ;;
+         esac
+         return 0
+     fi
+

diff --git a/sys-fs/zfs/zfs-9999.ebuild b/sys-fs/zfs/zfs-2.1.5-r2.ebuild
similarity index 97%
copy from sys-fs/zfs/zfs-9999.ebuild
copy to sys-fs/zfs/zfs-2.1.5-r2.ebuild
index 6e0b78a9c125..37907ff20733 100644
--- a/sys-fs/zfs/zfs-9999.ebuild
+++ b/sys-fs/zfs/zfs-2.1.5-r2.ebuild
@@ -100,6 +100,15 @@ REQUIRED_USE="
 
 RESTRICT="test"
 
+PATCHES=(
+       # bug #855182
+       "${FILESDIR}"/${PV}-build-issues.patch
+       # bug #854333
+       "${FILESDIR}"/${PV}-r2-dracut-non-root.patch
+       #
+       "${FILESDIR}"/2.1.5-dracut-zfs-missing.patch
+)
+
 pkg_pretend() {
        use rootfs || return 0
 

diff --git a/sys-fs/zfs/zfs-9999.ebuild b/sys-fs/zfs/zfs-9999.ebuild
index 6e0b78a9c125..b3a9d416fb6e 100644
--- a/sys-fs/zfs/zfs-9999.ebuild
+++ b/sys-fs/zfs/zfs-9999.ebuild
@@ -100,6 +100,10 @@ REQUIRED_USE="
 
 RESTRICT="test"
 
+PATCHES=(
+       "${FILESDIR}"/2.1.5-dracut-zfs-missing.patch
+)
+
 pkg_pretend() {
        use rootfs || return 0
 

Reply via email to