commit:     cb6dccf51bf2ae325c962febb48158f705f4c34c
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 16 20:26:14 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Tue Jul 16 20:29:15 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=cb6dccf5

linuxrc: Tell user why we consider a root device as invalid

Bug: https://bugs.gentoo.org/520018
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/linuxrc | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 6b69a13..99874a6 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -786,17 +786,41 @@ do
                # else not a good root and start over.
                if [ "${mountret}" = '0' ]
                then
-                       if [ -x "${NEW_ROOT}${REAL_INIT:-/sbin/init}" ] \
-                               || [ -L "${NEW_ROOT}${REAL_INIT:-/sbin/init}" 
-o -x "${NEW_ROOT}/bin/sh" ] \
-                               || [ "${REAL_ROOT}" = "/dev/nfs" ]
+                       if [ -x "${NEW_ROOT}${REAL_INIT:-/sbin/init}" ]
                        then
                                break
                        else
-                               bad_msg "The filesystem mounted at ${REAL_ROOT} 
does not appear to be a valid /, try again"
-                               got_good_root=0
+                               warn_msg "${NEW_ROOT}${REAL_INIT:-/sbin/init} 
was not found or is not executable, maybe a symlink?" ${QUIET}
                        fi
+
+                       if [ -L "${NEW_ROOT}${REAL_INIT:-/sbin/init}" ]
+                       then
+                               good_msg "Symlink detected! Assuming split /usr 
..." ${QUIET}
+                               break
+                       else
+                               warn_msg "${NEW_ROOT}${REAL_INIT:-/sbin/init} 
is not a symlink, do we have at least /bin/sh?" ${QUIET}
+                       fi
+
+                       if [ -x "${NEW_ROOT}/bin/sh" ]
+                       then
+                               good_msg "Executable ${NEW_ROOT}/bin/sh 
detected!" ${QUIET}
+                               break
+                       else
+                               warn_msg "${NEW_ROOT}/bin/sh was not found or 
is not executable, maybe we are working with NFS?" ${QUIET}
+                       fi
+
+                       if [ "${REAL_ROOT}" = "/dev/nfs" ]
+                       then
+                               good_msg "NFS detected!" ${QUIET}
+                               break
+                       else
+                               warn_msg "No NFS detected!" ${QUIET}
+                       fi
+
+                       bad_msg "The filesystem mounted at ${REAL_ROOT} does 
not appear to be a valid /!"
+                       got_good_root=0
                else
-                       bad_msg "Could not mount specified ROOT, try again"
+                       bad_msg "Could not mount specified ROOT!"
                        got_good_root=0
                fi
        fi

Reply via email to