resume: Fix failure when invalid device passed via 'resume='

This commit allows the waiting for a device to be cancelled.
When the resume partition does not exist, it becomes quite hard
to work out what to do (you have to either create the
/dev/resume symlink manually, or remove the 'finished' job
that is waiting for it). Additionally dracut incorrectly
displays a message about not being able to find the root
device, which is bogus and misleading.

This commit should just bail on the whole resume thing
if the device cannot be found and proceed with a normal boot.
master
Colin Guthrie 2011-12-31 13:30:58 +00:00 committed by Harald Hoyer
parent 5d55ceb75c
commit f65b874bda
2 changed files with 11 additions and 0 deletions

View File

@ -35,6 +35,9 @@ if [ -n "$resume" ]; then
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job"; }\n' \
"$resume" "$resume" >> $hookdir/initqueue/settled/resume.sh

printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm "$job" "%s/initqueue/settled/resume.sh";' \
"$hookdir" >> $hookdir/initqueue/timeout/resume.sh

wait_for_dev "/dev/resume"

elif ! getarg noresume; then

View File

@ -717,6 +717,14 @@ wait_for_dev()
} >> "$hookdir/emergency/80-${_name}.sh"
}

cancel_wait_for_dev()
{
local _name
_name="$(str_replace "$1" '/' '\\x2f')"
rm -f "$hookdir/initqueue/finished/devexists-${_name}.sh"
rm -f "$hookdir/emergency/80-${_name}.sh"
}

killproc() {
local _exe="$(command -v $1)"
local _sig=$2