diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2012-09-27 15:20:50 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-28 11:07:40 +0100 |
commit | ffb6928f5783e5202d9849c3a185e29be1d41c63 (patch) | |
tree | 9ea6987b1e8f910a8ee4ac270111d5813efec4cc /meta | |
parent | 6d3d4baeebc850492d523419683348cffa2d63b0 (diff) | |
download | poky-ffb6928f5783e5202d9849c3a185e29be1d41c63.tar.gz |
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 <damien.lespiau@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-core/initrdscripts/files/init-live.sh | 11 |
1 files changed, 11 insertions, 0 deletions
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 @@ | |||
2 | 2 | ||
3 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | 3 | PATH=/sbin:/bin:/usr/sbin:/usr/bin |
4 | 4 | ||
5 | emergency_shell() | ||
6 | { | ||
7 | echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!" | ||
8 | echo | ||
9 | sh | ||
10 | } | ||
11 | trap "emergency_shell" 0 2 | ||
12 | |||
13 | # exit immediately if a command fails | ||
14 | set -e | ||
15 | |||
5 | ROOT_MOUNT="/rootfs/" | 16 | ROOT_MOUNT="/rootfs/" |
6 | ROOT_IMAGE="rootfs.img" | 17 | ROOT_IMAGE="rootfs.img" |
7 | MOUNT="/bin/mount" | 18 | MOUNT="/bin/mount" |