[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#795832: [PATCH initramfs-tools] initramfs-tools: Support multiple break points using a comma delimiter



Thanks for your patch, but I would prefer to avoid adding more sub-
shells.  Also, this change needs to be documented.  What do you t
hink of this patch?

Ben.
---
Closes: #795832
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 initramfs-tools.8 | 3 ++-
 scripts/functions | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/initramfs-tools.8 b/initramfs-tools.8
index ea8c098..a276be3 100644
--- a/initramfs-tools.8
+++ b/initramfs-tools.8
@@ -110,7 +110,8 @@ Use for example "debug=vc".
 spawns a shell in the initramfs image at the chosen phase
 (top, modules, premount, mount, mountroot, bottom, init)
 before actually executing the corresponding scripts
-(see the "Boot scripts" section) or action.
+(see the "Boot scripts" section) or action.  Multiple
+phases may be specified, delimited by commas.
 The default, if no phase is specified, is "premount".
 Beware that if both "panic" and "break" are present,
 initramfs will not spawn any shells but reboot instead.
diff --git a/scripts/functions b/scripts/functions
index 33fddcf..91d3407 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -61,9 +61,11 @@ panic()
 
 maybe_break()
 {
-	if [ "${break:-}" = "$1" ]; then
+	case ",$break," in
+	*,$1,*)
 		panic "Spawning shell within the initramfs"
-	fi
+		;;
+	esac
 }
 
 render()
-- 
Ben Hutchings
I'm always amazed by the number of people who take up solipsism because
they heard someone else explain it. - E*Borg on alt.fan.pratchett

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: