Commit 25837a14 authored by Ben Hutchings's avatar Ben Hutchings

scripts/local-premount/resume: Use local_device_setup for resume device

Currently we don't wait for the resume device to appear, and will boot
without resuming if it is too slow to appear (e.g. USB storage or, in
the reported case, an NVMe device!).

Use local_device_setup to wait for the device, the same as we do for
the root and /usr devices.  This also takes care of resolving UUID=
and LABEL= syntax, and adds support for PARTUUID= and PARTLABEL=.
Signed-off-by: 's avatarBen Hutchings <ben@decadent.org.uk>
Closes: #854791
parent 2be97ee7
......@@ -19,43 +19,16 @@ if [ -z "${resume}" ] || [ ! -e /sys/power/resume ]; then
exit 0
fi
case $resume in
LABEL=*)
resume="${resume#LABEL=}"
. /scripts/functions
. /scripts/local
# support any / in LABEL= path (escape to \x2f)
case "${resume}" in
*/*)
if command -v sed >/dev/null 2>&1; then
resume="$(echo ${resume} | sed 's,/,\\x2f,g')"
else
if [ "${resume}" != "${resume#/}" ]; then
resume="\x2f${resume#/}"
fi
if [ "${resume}" != "${resume%/}" ]; then
resume="${resume%/}\x2f"
fi
IFS='/'
newresume=
for s in $resume; do
newresume="${newresume:+${newresume}\\x2f}${s}"
done
unset IFS
resume="${newresume}"
fi
esac
resume="/dev/disk/by-label/${resume}"
;;
UUID=*)
resume="/dev/disk/by-uuid/${resume#UUID=}"
;;
esac
[ ! -e "${resume}" ] && exit 0
if ! local_device_setup ${resume} "suspend/resume device" false; then
exit 0
fi
# hardcode path, uswsusp ships an resume binary too
if [ -n "${resume_offset}" ]; then
/bin/resume ${resume} ${resume_offset}
/bin/resume ${DEV} ${resume_offset}
else
/bin/resume ${resume}
/bin/resume ${DEV}
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment