Blob Blame History Raw
From 9e17bed7c0f30f6c557f837592772522c384779b Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Tue, 15 Feb 2022 13:44:16 +0100
Subject: [PATCH] Revert "95resume: always install this module"

This reverts commit 058ffa90669a4dbd2af16e025f22312408ed4ba9.

Resolves: #2017787
---
 modules.d/95resume/module-setup.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
index 4f68e947..f0507b13 100755
--- a/modules.d/95resume/module-setup.sh
+++ b/modules.d/95resume/module-setup.sh
@@ -2,6 +2,20 @@
 
 # called by dracut
 check() {
+    swap_on_netdevice() {
+        local _dev
+        for _dev in "${swap_devs[@]}"; do
+            block_is_netdevice "$_dev" && return 0
+        done
+        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 || [[ "$(cat /sys/power/resume)" == "0:0" ]] && return 255
+    }
+
     return 0
 }