summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Prokop <mika@debian.org>2010-07-31 14:20:21 -0400
committerMichael Prokop <mika@debian.org>2010-08-06 23:02:05 -0400
commita0c314053b1818a370e6a6aca21dd2594e75ca31 (patch)
tree4c63d996586edb6cdc37121158037772b1657043
parente7daaf7fdf80ba63626515ca3e3e3054aaac0417 (diff)
downloadinitramfs-tools-a0c314053b1818a370e6a6aca21dd2594e75ca31.tar.gz
initramfs-tools-a0c314053b1818a370e6a6aca21dd2594e75ca31.zip
init: provide fastforward path for the common case when validating init binary.
-rwxr-xr-xinit27
1 files changed, 15 insertions, 12 deletions
diff --git a/init b/init
index dee5625..abe3c9b 100755
--- a/init
+++ b/init
@@ -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