diff options
author | maximilian attems <max@dual.(none)> | 2007-09-03 11:45:39 +0200 |
---|---|---|
committer | maximilian attems <max@dual.(none)> | 2007-09-03 11:45:39 +0200 |
commit | 748cff514e9033e1a7984f26ece7ed25079e3535 (patch) | |
tree | 2ee0045190b710e4720a3073330ba61596185bf6 | |
parent | a2086c2f2344f3db4fbcbfb707317655e173058a (diff) | |
download | initramfs-tools-748cff514e9033e1a7984f26ece7ed25079e3535.tar.gz initramfs-tools-748cff514e9033e1a7984f26ece7ed25079e3535.zip |
init: search for valid init
Fixes bootfailure on bogus init bootarg too.
Plus there may be a rootfs without init, but with sh.
-rw-r--r-- | debian/changelog | 4 | ||||
-rwxr-xr-x | init | 23 |
2 files changed, 23 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog index 66dceea..0bdb6b9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,8 +11,10 @@ initramfs-tools (0.91) UNRELEASED; urgency=low * init: Call panic for debug sh if run-init fails. * init-top/framebuffer: Check that fb minor is below 32. * init: Export noresume if set. uswsusp and kdump need it. + * init: Try harder to find a valid init on rootmnt. Fixes bootfailure on + bogus init bootarg too. - -- maximilian attems <maks@debian.org> Sat, 01 Sep 2007 13:40:24 +0200 + -- maximilian attems <maks@debian.org> Mon, 03 Sep 2007 11:44:04 +0200 initramfs-tools (0.90a) unstable; urgency=high @@ -176,9 +176,26 @@ run_scripts /scripts/init-bottom mount -n -o move /sys ${rootmnt}/sys mount -n -o move /proc ${rootmnt}/proc -while [ ! -x ${rootmnt}${init} ]; do - panic "Target filesystem doesn't have ${init}" -done +# Check init bootarg +if [ -n "${init}" ] && [ ! -x "${rootmnt}${init}" ]; then + init= + echo "Target filesystem doesn't have ${init}." +fi + +# Search for valid init +if [ -z "${init}" ] ; then + for init in /sbin/init /etc/init /bin/init /bin/sh; do + if [ ! -x "${rootmnt}${i}" ]; then + continue + fi + break + done +fi + +# No init on rootmount +if [ ! -x "${rootmnt}${init}" ]; then + panic "No init found. Try passing init= bootarg." +fi # Confuses /etc/init.d/rc if [ -n ${debug} ]; then |