diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-30 10:00:06 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-30 10:00:06 +0000 |
commit | 9d2d251a12fbda825b77e05ee6fb314d89079036 (patch) | |
tree | ef5721d25c5d6d61c28a7b372d19116fad293ace | |
parent | 69b0ce93181613485137e67931664c123cbef81d (diff) | |
download | mkinitfs-9d2d251a12fbda825b77e05ee6fb314d89079036.tar.bz2 mkinitfs-9d2d251a12fbda825b77e05ee6fb314d89079036.tar.xz |
init: check for /sbin/init before moving mounts
-rwxr-xr-x | initramfs-init.in | 10 |
1 files 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 |