Skip to content

Commit

Permalink
fix(resume): check for presence of /sys/power/resume
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
sharkcz authored and johannbg committed Nov 24, 2021
1 parent 4855242 commit 0b97790
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules.d/95resume/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0b97790

Please sign in to comment.