Skip to content

Commit 0cf93ad

Browse files
committed
only run resume function if /sys/power/resume exists
Signed-off-by: Zen <[email protected]>
1 parent 5927ada commit 0cf93ad

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/ugrd/fs/mounts.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "5.1.0"
2+
__version__ = "5.1.1"
33

44
from pathlib import Path
55

@@ -744,10 +744,11 @@ def resolve_blkdev_kmod(self, device) -> list[str]:
744744

745745

746746
def handle_resume(self) -> None:
747-
"""Returns a bash script handling resume if "resume" is specified.
748-
It must determine if the specified device exists, then echo the resume device to /sys/power/resume."""
747+
"""Returns a bash script handling resume if specified.
748+
Checks that /sys/power/resume is writable, and if resume= is set, if so,
749+
it checks ifthe specified device exists, then echo's the resume device to /sys/power/resume."""
749750
return [
750-
'if [ -n "$(readvar resume)" ]; then',
751+
'if [ -n "$(readvar resume)" ] && [ -w /sys/power/resume ]; then',
751752
' if [ -e "$(readvar resume)" ]; then',
752753
' einfo "Resuming from: $(readvar resume)"',
753754
" readvar resume > /sys/power/resume",

0 commit comments

Comments
 (0)