[PATCH] job control fixup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


- in case no ctty was provided, shell was spawned without caring about
  /dev/console

Also, the ctty is more opportunistic. If the image was generated with
--ctty, we will fallback to /dev/tty1 if rc.ctty is invalid or missing.
Otherwise we spawn standard shell on /dev/console

Signed-off-by: Michal Soltys <soltys@xxxxxxxx>
---
 modules.d/99base/init         |    8 +++++---
 modules.d/99shutdown/shutdown |    9 +++++----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/modules.d/99base/init b/modules.d/99base/init
index 54d5281..76c6957 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -59,11 +59,13 @@ emergency_shell()
         echo
         export PS1="$_rdshell_name:\${PWD}# "
         [ -e /.profile ] || >/.profile
-        _ctty="$(getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
-        if type setsid >/dev/null 2>&1 && [ -c "$_ctty" ] ; then
+        _ctty=/dev/console
+        if type setsid >/dev/null 2>&1; then
+            _ctty="$(getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
+            [ -c "$_ctty" ] || _ctty=/dev/tty1
             setsid sh -i -l 0<$_ctty 1>$_ctty 2>&1
         else
-            sh -i -l
+            sh -i -l 0<$_ctty 1>$_ctty 2>&1
         fi
     else
         warn "Boot has failed. To debug this issue add \"rdshell\" to the kernel command line."
diff --git a/modules.d/99shutdown/shutdown b/modules.d/99shutdown/shutdown
index 9473b5b..21bb37f 100755
--- a/modules.d/99shutdown/shutdown
+++ b/modules.d/99shutdown/shutdown
@@ -31,12 +31,13 @@ emergency_shell()
         echo
         export PS1="$_rdshell_name:\${PWD}# "
         [ -e /.profile ] || >/.profile
-        _ctty="$(getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
-        if type setsid >/dev/null 2>&1 && [ -c "$_ctty" ] ; then
-            _ctty=/dev/${_ctty##*/}
+        _ctty=/dev/console
+        if type setsid >/dev/null 2>&1; then
+            _ctty="$(getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
+            [ -c "$_ctty" ] || _ctty=/dev/tty1
             setsid sh -i -l 0<$_ctty 1>$_ctty 2>&1
         else
-            sh -i -l
+            sh -i -l 0<$_ctty 1>$_ctty 2>&1
         fi
     else
         exec /lib/systemd/systemd-shutdown "$@"
-- 
1.7.5.3

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Home]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Add to Google Powered by Linux