systemd/0009-pid1-handle-console-specificities-weirdness-for-s390.patch

63 lines
2.0 KiB
Diff

From 09184a555aec3ef612425ba6fe596cf05383ca09 Mon Sep 17 00:00:00 2001
From: Franck Bui <fbui@suse.com>
Date: Fri, 10 Jun 2016 15:19:57 +0200
Subject: [PATCH 1/1] pid1: handle console specificities/weirdness for s390
arch
The 3270 console on S/390 can do color but not the 3215 console.
Partial forward port of
0001-On_s390_con3270_disable_ANSI_colour_esc.patch from SLE12-SP1. A
bunch of the previous code has been dropped since some changes
imported from upsteam made them uneeded.
The remaining bits are probably hackish but at least they are now
minimal.
It was an attempt to address bnc#860937 to automatically turn the console color
mode off by passing $TERM=dumb when the specified terminal device is other than
"3270". For more details, see
https://www.ibm.com/docs/en/linux-on-systems?topic=setup-kernel-parameters.
See also a short discussion which happened on @systemd-maintainers
whose $subject is "[PATCH] support conmode setting on command line".
[fbui: fixes bsc#860937]
Don't warn if "conmode=" is missing as this option should not be passed on
s390x KVM.
[fbui: fixes bsc#1236725]
---
src/basic/terminal-util.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
index 409f2abb45..630fc81836 100644
--- a/src/basic/terminal-util.c
+++ b/src/basic/terminal-util.c
@@ -912,7 +912,19 @@ bool tty_is_vc_resolve(const char *tty) {
}
const char* default_term_for_tty(const char *tty) {
- return tty && tty_is_vc_resolve(tty) ? "linux" : "vt220";
+ if (tty && tty_is_vc_resolve(tty))
+ return "linux";
+
+#if defined (__s390__) || defined (__s390x__)
+ if (tty && tty_is_console(tty)) {
+ _cleanup_free_ char *mode = NULL;
+
+ /* Returns "dumb" in case of OOM. */
+ (void) proc_cmdline_get_key("conmode", 0, &mode);
+ return streq_ptr(mode, "3270") ? "ibm327x" : "dumb";
+ }
+#endif
+ return "vt220";
}
int fd_columns(int fd) {
--
2.43.0