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 /init | |
| 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.
Diffstat (limited to 'init')
| -rwxr-xr-x | init | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -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 |
