parent
4560b11551
commit
b802018482
@ -177,20 +177,24 @@ fi
|
||||
if test -e /sys/power/resume -a -e /sys/power/disk; then
|
||||
if test -n "@resumeDevice@"; then
|
||||
resumeDev="@resumeDevice@"
|
||||
resumeInfo="$(udevadm info -q property "$resumeDev" )"
|
||||
else
|
||||
for sd in @resumeDevices@; do
|
||||
# Try to detect resume device. According to Ubuntu bug:
|
||||
# https://bugs.launchpad.net/ubuntu/+source/pm-utils/+bug/923326/comments/1
|
||||
# When there are multiple swap devices, we can't know where will hibernate
|
||||
# image reside. We can check all of them for swsuspend blkid.
|
||||
if [ "$(udevadm info -q property "$sd" | sed -n 's/^ID_FS_TYPE=//p')" = "swsuspend" ]; then
|
||||
resumeInfo="$(udevadm info -q property "$sd" )"
|
||||
if [ "$(echo "$resumeInfo" | sed -n 's/^ID_FS_TYPE=//p')" = "swsuspend" ]; then
|
||||
resumeDev="$sd"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if test -n "$resumeDev"; then
|
||||
readlink -f "$resumeDev" > /sys/power/resume 2> /dev/null || echo "failed to resume..."
|
||||
if test -e "$resumeDev"; then
|
||||
resumeMajor="$(echo "$resumeInfo" | sed -n 's/^MAJOR=//p')"
|
||||
resumeMinor="$(echo "$resumeInfo" | sed -n 's/^MINOR=//p')"
|
||||
echo "$resumeMajor:$resumeMinor" > /sys/power/resume 2> /dev/null || echo "failed to resume..."
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user