54 lines
2.1 KiB
Diff
54 lines
2.1 KiB
Diff
|
From f65b874bda9f8b12d41c1f07826f584a8f5dcf6d Mon Sep 17 00:00:00 2001
|
||
|
From: Colin Guthrie <colin@mageia.org>
|
||
|
Date: Sat, 31 Dec 2011 13:30:58 +0000
|
||
|
Subject: [PATCH] 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.
|
||
|
---
|
||
|
modules.d/95resume/resume-genrules.sh | 3 +++
|
||
|
modules.d/99base/dracut-lib.sh | 8 ++++++++
|
||
|
2 files changed, 11 insertions(+), 0 deletions(-)
|
||
|
|
||
|
diff --git a/modules.d/95resume/resume-genrules.sh b/modules.d/95resume/resume-genrules.sh
|
||
|
index 16df877..ee4eacb 100755
|
||
|
--- a/modules.d/95resume/resume-genrules.sh
|
||
|
+++ b/modules.d/95resume/resume-genrules.sh
|
||
|
@@ -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
|
||
|
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
|
||
|
index 9eae4d9..b4fb435 100755
|
||
|
--- a/modules.d/99base/dracut-lib.sh
|
||
|
+++ b/modules.d/99base/dracut-lib.sh
|
||
|
@@ -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
|