udevadm trigger >/dev/null 2>&1
# mount the rootfs
-export NEWROOT="/sysroot"
+NEWROOT="/sysroot"
# FIXME: there's got to be a better way ...
# it'd be nice if we had a udev rule that just did all of the bits for
}
source_all pre-pivot
-
-exec switch_root "$NEWROOT" "$INIT" $CMDLINE
-# davej doesn't like initrd bugs
-echo "Something went very badly wrong in the initrd. Please "
-echo "file a bug against mkinitrd."
-sleep 100d
-exit 1
+echo "Switching to real root filesystem $root"
+exec switch_root "$NEWROOT" "$INIT" $CMDLINE || {
+ # davej doesn't like initrd bugs
+ echo "Something went very badly wrong in the initrd. Please "
+ echo "file a bug against mkinitrd."
+ emergency_shell
+}
# start looking for required binaries and bits of infrastructure
BINDIRS="/bin /sbin /usr/bin /usr/sbin"
-INITDIRS="/sbin /etc /"
RM=$(simple_find rm $BINDIRS) || die "Cannnot find rm on $NEWROOT"
CHROOT=$(simple_find chroot $BINDIRS) || die "Cannot find chroot on $NEWROOT"
LDD=$(simple_find ldd $BINDIRS) || die "Cannot find ldd on $NEWROOT"
# exec init.
NEWROOT="."
update_newroot_libpath
-run_from_newroot "$CHROOT_LDSO" exec "$CHROOT" "$NEWROOT" "$INIT" "$@"
-die "The chroot did not take for some reason"
+run_from_newroot "$CHROOT_LDSO" exec "$CHROOT" "$NEWROOT" "$INIT" "$@" || \
+ die "The chroot did not take for some reason"