ref: 9d2d251a12fbda825b77e05ee6fb314d89079036
parent: 69b0ce93181613485137e67931664c123cbef81d
author: Natanael Copa <ncopa@alpinelinux.org>
date: Thu Jul 30 05:00:06 CDT 2009
init: check for /sbin/init before moving mounts
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -368,6 +368,12 @@
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 @@
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