commit:     ccf10d5bff7cf622888b45fed3eb79213f5743bd
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 15 20:11:24 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Jul 15 20:11:24 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=ccf10d5b

linuxrc: Fix waiting on root

The idea of that loop is to respect ROOTDELAY and allow for slow
devices to come up. But if we will prompt already on first failure,
this doesn't work.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/linuxrc | 27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 63e2360..5a95ece 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -623,13 +623,9 @@ do
                                        if [ ${retval} -eq 0 ] && [ -n 
"${ROOT_DEV}" ]
                                        then
                                                got_good_root=1
-                                               good_msg "Detected 
real_root=${ROOT_DEV}"
                                                REAL_ROOT="${ROOT_DEV}"
+                                               good_msg "Detected 
real_root=${ROOT_DEV}"
                                                break
-                                       else
-                                               prompt_user "REAL_ROOT" "root 
block device"
-                                               got_good_root=0
-                                               continue
                                        fi
                                ;;
                                ZFS*)
@@ -647,10 +643,10 @@ do
                                                        got_good_root=1
                                                        REAL_ROOT=${ROOT_DEV}
                                                        ROOTFSTYPE=zfs
+                                                       good_msg "Detected 
real_root=${ROOT_DEV}"
+                                                       break
                                                else
                                                        bad_msg "${ROOT_DEV} is 
not a filesystem"
-                                                       prompt_user "REAL_ROOT" 
"root block device"
-                                                       got_good_root=0
                                                        continue
                                                fi
                                        else
@@ -660,28 +656,17 @@ do
                                                        for i in ${BOOTFS}
                                                        do
                                                                zfs get type 
${i} > /dev/null 2>&1
-                                                               retval=$?
-
-                                                               if [ ${retval} 
-eq 0 ]
+                                                               if [ $? -eq 0 ]
                                                                then
                                                                        
got_good_root=1
                                                                        
REAL_ROOT=${i}
                                                                        
ROOTFSTYPE=zfs
+                                                                       
good_msg "Detected real_root=${ROOT_DEV}"
                                                                        break
                                                                fi
                                                        done
-                                               else
-                                                       got_good_root=0
                                                fi
                                        fi
-
-                                       if [ ${got_good_root} -ne 1 ]
-                                       then
-                                               prompt_user "REAL_ROOT" "root 
block device"
-                                               got_good_root=0
-                                       fi
-
-                                       continue
                                ;;
                        esac
 
@@ -692,7 +677,7 @@ do
                        fi
                done  # End of sleep loop waiting on root
 
-               if [ "${REAL_ROOT}" = '' ]
+               if [ -z "${REAL_ROOT}" ]
                then
                        # No REAL_ROOT determined/specified. Prompt user for 
root block device.
                        prompt_user "REAL_ROOT" "root block device"

Reply via email to