From: Michal Soltys <soltys-R61QfzASbfY@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] job control fixup
Date: Tue, 18 Oct 2011 00:02:13 +0200 [thread overview]
Message-ID: <1318888933-13440-1-git-send-email-soltys@ziu.info> (raw)
In-Reply-To: <1318885310-12535-2-git-send-email-soltys-R61QfzASbfY@public.gmane.org>
- 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-R61QfzASbfY@public.gmane.org>
---
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
next prev parent reply other threads:[~2011-10-17 22:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-17 21:01 [PATCH] introduce optional job control Michal Soltys
[not found] ` <1318885310-12535-2-git-send-email-soltys-R61QfzASbfY@public.gmane.org>
2011-10-17 22:02 ` Michal Soltys [this message]
2011-10-18 9:52 ` WANG Cong
2011-10-18 10:23 ` Michal Soltys
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318888933-13440-1-git-send-email-soltys@ziu.info \
--to=soltys-r61qfzasbfy@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).