Skip to content

Commit 62f8287

Browse files
linuxandos2desultory
authored andcommitted
Update resume.py to handle also UUID= and LABEL= among PARTUUID=
1 parent c9c5734 commit 62f8287

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ugrd/fs/resume.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
def resume(self) -> None:
77
"""Returns a shell script handling resume from hibernation.
88
Checks that /sys/power/resume is writable, resume= is set, and noresume is not set, if so,
9-
checks if PARTUUID= is in the resume var, and tries to use blkid to find the resume device.
9+
checks if UUID= or PARTUUID= or LABEL= is in the resume var,
10+
and tries to use blkid to find the resume device.
1011
If the specified device exists, writes resume device to /sys/power/resume.
1112
In the event of failure, it prints an error message, a list of block devuices, then runs rd_fail.
1213
@@ -36,9 +37,11 @@ def resume(self) -> None:
3637

3738
def handle_early_resume(self) -> None:
3839
return [
39-
"resumeval=$(readvar resume)",
40-
'if ! check_var noresume && [ -n "$resumeval" ] ; then',
41-
' if echo "$resumeval" | grep -qE "^PARTUUID=|^UUID="; then',
40+
"resumeval=$(readvar resume)", # read the cmdline resume var
41+
'if ! check_var noresume && [ -n "$resumeval" ] && [ -w /sys/power/resume ]; then',
42+
' if echo "$resumeval" | grep -q "UUID=" ||', # resolve uuid to device
43+
' echo "$resumeval" | grep -q "PARTUUID=" ||', # or resolve partuuid to device
44+
' echo "$resumeval" | grep -q "LABEL=" ; then', # or resolve label to device
4245
' resume=$(blkid -t "$resumeval" -o device)',
4346
" else",
4447
' resume="$resumeval"',

0 commit comments

Comments
 (0)