From: "Mike Gilbert" <floppym@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-kernel/dracut/, sys-kernel/dracut/files/
Date: Thu, 9 Nov 2023 02:37:31 +0000 (UTC) [thread overview]
Message-ID: <1699496861.803a7e0b95164ddb661dee1448a4b19eceb09cc2.floppym@gentoo> (raw)
commit: 803a7e0b95164ddb661dee1448a4b19eceb09cc2
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 7 15:00:13 2023 +0000
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Nov 9 02:27:41 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=803a7e0b
sys-kernel/dracut: fix resume module in hostonly mode
Closes: https://bugs.gentoo.org/917000
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
sys-kernel/dracut/dracut-060_pre20231030.ebuild | 1 +
.../files/dracut-060-fix-resume-hostonly.patch | 65 ++++++++++++++++++++++
2 files changed, 66 insertions(+)
diff --git a/sys-kernel/dracut/dracut-060_pre20231030.ebuild b/sys-kernel/dracut/dracut-060_pre20231030.ebuild
index f6149bdc6877..25b978da1b87 100644
--- a/sys-kernel/dracut/dracut-060_pre20231030.ebuild
+++ b/sys-kernel/dracut/dracut-060_pre20231030.ebuild
@@ -68,6 +68,7 @@ QA_MULTILIB_PATHS="usr/lib/dracut/.*"
PATCHES=(
"${FILESDIR}"/gentoo-ldconfig-paths-r1.patch
+ "${FILESDIR}"/dracut-060-fix-resume-hostonly.patch
)
src_configure() {
diff --git a/sys-kernel/dracut/files/dracut-060-fix-resume-hostonly.patch b/sys-kernel/dracut/files/dracut-060-fix-resume-hostonly.patch
new file mode 100644
index 000000000000..3563f85293fd
--- /dev/null
+++ b/sys-kernel/dracut/files/dracut-060-fix-resume-hostonly.patch
@@ -0,0 +1,65 @@
+https://bugs.gentoo.org/917000
+https://github.com/dracutdevs/dracut/pull/2494
+
+From b88d0bab791bdc4ca75d13802f0391caf537650d Mon Sep 17 00:00:00 2001
+From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
+Date: Sun, 20 Aug 2023 11:47:22 +0200
+Subject: [PATCH] fix(resume): include in hostonly mode if resume= on cmdline
+
+The grep introduced in commit e3a7112bef794e2f2dd741ec2c74fa9cb9117651
+does not work as intended. The resume module is always excluded in hostonly
+mode.
+
+Made this a bit more explicit with if/else so it is more clear what is going
+on. The in-line ||/&& makes the line really long and makes it more difficult
+to understand what is going on.
+
+Bug: https://github.com/dracutdevs/dracut/issues/924
+Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
+---
+ modules.d/95resume/module-setup.sh | 32 +++++++++++++++++++++++-------
+ 1 file changed, 25 insertions(+), 7 deletions(-)
+
+diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
+index d255103366..2d48043827 100755
+--- a/modules.d/95resume/module-setup.sh
++++ b/modules.d/95resume/module-setup.sh
+@@ -10,13 +10,31 @@ check() {
+ return 1
+ }
+
+- # Only support resume if hibernation is currently on
+- # and no swap is mounted on a net device
+- [[ $hostonly ]] || [[ $mount_needs ]] && {
+- swap_on_netdevice || [[ -f /sys/power/resume && "$(< /sys/power/resume)" == "0:0" ]] || grep -rq '^\|[[:space:]]resume=' /proc/cmdline /etc/cmdline /etc/cmdline.d /etc/kernel/cmdline /usr/lib/kernel/cmdline 2> /dev/null && return 255
+- }
+-
+- return 0
++ # If hostonly check if we want to include the resume module
++ if [[ $hostonly ]] || [[ $mount_needs ]]; then
++ # Resuming won't work if swap is on a netdevice
++ swap_on_netdevice && return 255
++ if grep -rq 'resume=' /proc/cmdline /etc/cmdline /etc/cmdline.d /etc/kernel/cmdline /usr/lib/kernel/cmdline 2> /dev/null; then
++ # hibernation support requested on kernel command line
++ return 0
++ else
++ # resume= not set on kernel command line
++ if [[ -f /sys/power/resume ]]; then
++ if [[ "$(< /sys/power/resume)" == "0:0" ]]; then
++ # hibernation supported by the kernel, but not enabled
++ return 255
++ else
++ # hibernation supported by the kernel and enabled
++ return 0
++ fi
++ else
++ # resume file doesn't exist, hibernation not supported by kernel
++ return 255
++ fi
++ fi
++ else
++ return 0
++ fi
+ }
+
+ # called by dracut
next reply other threads:[~2023-11-09 2:37 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-09 2:37 Mike Gilbert [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-02-09 9:30 [gentoo-commits] repo/gentoo:master commit in: sys-kernel/dracut/, sys-kernel/dracut/files/ Nowa Ammerlaan
2024-11-14 18:15 Nowa Ammerlaan
2024-11-09 14:31 Andrew Ammerlaan
2024-07-16 16:52 Andrew Ammerlaan
2024-07-14 8:21 Andrew Ammerlaan
2024-03-17 16:53 Andrew Ammerlaan
2024-02-03 7:43 Andrew Ammerlaan
2024-02-02 13:11 Andrew Ammerlaan
2024-01-15 9:46 Andrew Ammerlaan
2023-12-20 7:43 Florian Schmaus
2023-12-12 19:07 Mike Gilbert
2023-11-09 16:09 Mike Gilbert
2023-05-26 20:27 Mike Gilbert
2022-12-23 23:21 Mike Gilbert
2022-07-05 14:30 Mike Gilbert
2022-07-04 23:29 Mike Gilbert
2022-06-07 23:47 Sam James
2022-05-29 1:39 Mike Gilbert
2021-07-23 19:16 Mike Gilbert
2021-06-17 15:02 Mike Gilbert
2020-12-20 17:27 Mike Gilbert
2020-12-15 20:49 Mike Gilbert
2020-12-15 20:49 Mike Gilbert
2020-08-07 16:59 Mike Gilbert
2020-03-10 19:50 Mike Gilbert
2018-10-09 19:23 Mike Gilbert
2018-01-07 16:56 Mike Gilbert
2017-07-04 2:52 Mike Gilbert
2015-08-16 10:36 Amadeusz Żołnowski
2015-08-12 23:09 Amadeusz Żołnowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1699496861.803a7e0b95164ddb661dee1448a4b19eceb09cc2.floppym@gentoo \
--to=floppym@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox