commit:     c81285f02aaad8bd8161d06976147e9c1aca7a8a
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 14 19:30:53 2021 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Mar 14 19:39:48 2021 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c81285f0

initrd.scripts: run_shell(): Exit early when /dev is gone

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

 defaults/initrd.scripts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 53cb633..ff956b0 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1072,6 +1072,10 @@ run_shell() {
                ${SH} --login
        fi
 
+       # Leave function early when /dev/null does not exist anymore,
+       # i.e. after failed switch_root call
+       [ ! -e /dev/null ] && return
+
        rm "${GK_SHELL_LOCKFILE}"
 
        echo

Reply via email to