]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
resume: Fix failure when invalid device passed via 'resume='
authorColin Guthrie <colin@mageia.org>
Sat, 31 Dec 2011 13:30:58 +0000 (13:30 +0000)
committerHarald Hoyer <harald@redhat.com>
Mon, 9 Jan 2012 12:33:13 +0000 (13:33 +0100)
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.

modules.d/95resume/resume-genrules.sh
modules.d/99base/dracut-lib.sh

index 16df8776ca6a2af46a3a47cf5cf22743d6cd510f..ee4eacbec19f546c7a79aa5d3f490b39a089b939 100755 (executable)
@@ -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
index 9eae4d911e8ec67a94ed6ea970ec3d8c1f132d62..b4fb43550c093f26f102dcecc65f58918c00400a 100755 (executable)
@@ -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