|
6 | 6 | def resume(self) -> None: |
7 | 7 | """Returns a shell script handling resume from hibernation. |
8 | 8 | 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. |
10 | 11 | If the specified device exists, writes resume device to /sys/power/resume. |
11 | 12 | In the event of failure, it prints an error message, a list of block devuices, then runs rd_fail. |
12 | 13 |
|
@@ -36,9 +37,11 @@ def resume(self) -> None: |
36 | 37 |
|
37 | 38 | def handle_early_resume(self) -> None: |
38 | 39 | 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 |
42 | 45 | ' resume=$(blkid -t "$resumeval" -o device)', |
43 | 46 | " else", |
44 | 47 | ' resume="$resumeval"', |
|
0 commit comments