From 9d2d251a12fbda825b77e05ee6fb314d89079036 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 30 Jul 2009 10:00:06 +0000 Subject: init: check for /sbin/init before moving mounts --- initramfs-init.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/initramfs-init.in b/initramfs-init.in index e092fac..317cf83 100755 --- a/initramfs-init.in +++ b/initramfs-init.in @@ -368,6 +368,12 @@ if [ -n "$KOPT_chart" ]; then chart_init="/sbin/bootchartd start-rootfs" fi +if [ ! -x $sysroot/sbin/init ]; then + echo "/sbin/init not found in new root. Launching emergency recovery shell" + echo "Type exit to continue boot." + /bin/busybox sh +fi + # switch over to new root cat /proc/mounts | while read DEV DIR TYPE OPTS ; do if [ "$DIR" != "/" -a "$DIR" != "$sysroot" -a -d "$DIR" ]; then @@ -378,9 +384,7 @@ done sync echo "" -if [ -x $sysroot/sbin/init ]; then - exec /bin/busybox switch_root $sysroot $chart_init /sbin/init $KOPT_init_args -fi +exec /bin/busybox switch_root $sysroot $chart_init /sbin/init $KOPT_init_args echo "initramfs emergency recovery shell launched" exec /bin/busybox sh -- cgit v1.2.3