From ffb6928f5783e5202d9849c3a185e29be1d41c63 Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Thu, 27 Sep 2012 15:20:50 +0100 Subject: initrd: Spawn an emergency shell when something goes wrong set -e allows to exit if a command fails. We install a trap and execute emergency_shell() when either the init script exits or when ctrl-c is typed (say if we are stuck somewhere and we want to debug it). (From OE-Core rev: ae5e2bd994e3f60d3803ab56e6ed34d08fbc56f0) Signed-off-by: Damien Lespiau Signed-off-by: Ross Burton Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- meta/recipes-core/initrdscripts/files/init-live.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'meta/recipes-core/initrdscripts') diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh index 3fba7dc3a1..fb7af31a13 100644 --- a/meta/recipes-core/initrdscripts/files/init-live.sh +++ b/meta/recipes-core/initrdscripts/files/init-live.sh @@ -2,6 +2,17 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin +emergency_shell() +{ + echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!" + echo + sh +} +trap "emergency_shell" 0 2 + +# exit immediately if a command fails +set -e + ROOT_MOUNT="/rootfs/" ROOT_IMAGE="rootfs.img" MOUNT="/bin/mount" -- cgit v1.2.3-54-g00ecf