Skip to content

Commit 0b97790

Browse files
sharkczjohannbg
authored andcommitted
fix(resume): check for presence of /sys/power/resume
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>
1 parent 4855242 commit 0b97790

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules.d/95resume/module-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ check() {
1313
# Only support resume if hibernation is currently on
1414
# and no swap is mounted on a net device
1515
[[ $hostonly ]] || [[ $mount_needs ]] && {
16-
swap_on_netdevice || [[ "$(cat /sys/power/resume)" == "0:0" ]] && return 255
16+
swap_on_netdevice || [[ -f /sys/power/resume && "$(cat /sys/power/resume)" == "0:0" ]] && return 255
1717
}
1818

1919
return 0

0 commit comments

Comments
 (0)