Commit 5b7c092b authored by Ben Hutchings's avatar Ben Hutchings

hooks/resume: Fix validation of resume devices specified by UUID etc.

The validation of the resume device in this hook has apparently
never worked for devices specified by UUID or label because
only 'blkid -t' handles those, not 'blkid -p'.  Use the shared
function resolve_device to translate with 'blkid -t' if
necessary.

Closes: #861057
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent c2969363
......@@ -15,10 +15,16 @@ prereqs)
;;
esac
# First check if a location is set and is a valid swap partition
. /usr/share/initramfs-tools/scripts/functions
# First check if a location is set and is a valid swap partition.
# If so, the config file will be copied in and there is nothing to do.
if [ -n "$RESUME" ] && [ "$RESUME" != auto ]; then
if [ "$RESUME" = none ] || blkid -p -n swap $RESUME >/dev/null 2>&1; then
# As mkinitramfs copies the config file nothing to do.
if [ "$RESUME" = none ]; then
exit 0
fi
if resume_dev_node="$(resolve_device "$RESUME")" && \
blkid -p -n swap "$resume_dev_node" >/dev/null 2>&1; then
exit 0
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