]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(resume): check for presence of /sys/power/resume
authorDan Horák <dan@danny.cz>
Wed, 10 Nov 2021 11:14:15 +0000 (12:14 +0100)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Wed, 24 Nov 2021 09:56:27 +0000 (09:56 +0000)
On platforms where the kernel is built without suspend/resume support we
see "cat: /sys/power/resume: No such file or directory" message when
creating an initrd image. Check for the presence of /sys/power/resume
first before reading it.

Signed-off-by: Dan Horák <dan@danny.cz>
modules.d/95resume/module-setup.sh

index f0507b136b514fc419c388a64752f051c9d687d8..b47acbece80e1a85140fcc8ed7850f2b2b8dd65f 100755 (executable)
@@ -13,7 +13,7 @@ check() {
     # 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
+        swap_on_netdevice || [[ -f /sys/power/resume && "$(cat /sys/power/resume)" == "0:0" ]] && return 255
     }
 
     return 0