summaryrefslogtreecommitdiff
path: root/sys-kernel/dracut/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-11-09 04:26:45 +0000
committerV3n3RiX <venerix@koprulu.sector>2023-11-09 04:26:45 +0000
commit70b888182faea1598e1b5e231078af492793858a (patch)
treed86ad10825fbafef78cb134e0c112cb04b3fedc2 /sys-kernel/dracut/files
parent4f8c8df3b07b6ea3556ab2bc7b252213bbdab3f3 (diff)
gentoo auto-resync : 09:11:2023 - 04:26:45
Diffstat (limited to 'sys-kernel/dracut/files')
-rw-r--r--sys-kernel/dracut/files/dracut-060-fix-resume-hostonly.patch65
1 files changed, 65 insertions, 0 deletions
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