commit:     9061be50c5e6650978138d1484ee6c988ea940a9
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 16 20:27:45 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Tue Jul 16 20:30:04 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=9061be50

linuxrc: Umount /newroot when it was rejected before prompting for a new root 
device

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

 defaults/linuxrc | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 99874a6..41a53fc 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -827,6 +827,18 @@ do
 
        if [ "${got_good_root}" = '0' ]
        then
+               if mountpoint "${NEW_ROOT}" 1>/dev/null 2>&1
+               then
+                       umount "${NEW_ROOT}" 1>/dev/null 2>&1
+                       if [ $? -ne 0 ]
+                       then
+                               echo
+                               bad_msg "Failed to umount ${REAL_ROOT} which 
was mounted as ${NEW_ROOT}!"
+                               warn_msg "You probably need to open a shell and 
restore mountpoint before you are able to mount another device as ${NEW_ROOT}."
+                               echo
+                       fi
+               fi
+
                bad_msg "Block device ${REAL_ROOT} is not a valid root device 
..."
                prompt_user "REAL_ROOT" "root block device"
                ROOTDELAY_TIME_WAITED=0

Reply via email to