diff options
author | Michael Prokop <mika@debian.org> | 2010-07-31 14:20:21 -0400 |
---|---|---|
committer | Michael Prokop <mika@debian.org> | 2010-08-06 23:02:05 -0400 |
commit | a0c314053b1818a370e6a6aca21dd2594e75ca31 (patch) | |
tree | 4c63d996586edb6cdc37121158037772b1657043 | |
parent | e7daaf7fdf80ba63626515ca3e3e3054aaac0417 (diff) | |
download | initramfs-tools-a0c314053b1818a370e6a6aca21dd2594e75ca31.tar.gz initramfs-tools-a0c314053b1818a370e6a6aca21dd2594e75ca31.zip |
init: provide fastforward path for the common case when validating init binary.
-rwxr-xr-x | init | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -257,19 +257,22 @@ if [ -n "${init}" ]; then fi fi -# Search for valid init -if [ -z "${init}" ] ; then - for inittest in /sbin/init /etc/init /bin/init /bin/sh; do - if validate_init "${inittest}"; then - init="$inittest" - break - fi - done -fi +# Common case: /sbin/init is present +if [ ! -x "${rootmnt}/sbin/init" ]; then + # ... if it's not available search for valid init + if [ -z "${init}" ] ; then + for inittest in /sbin/init /etc/init /bin/init /bin/sh; do + if validate_init "${inittest}"; then + init="$inittest" + break + fi + done + fi -# No init on rootmount -if ! validate_init "${init}" ; then - panic "No init found. Try passing init= bootarg." + # No init on rootmount + if ! validate_init "${init}" ; then + panic "No init found. Try passing init= bootarg." + fi fi maybe_break init |