From: Roland Hieber <rhi@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [ptxdist] [PATCH] rootfs: resize terminal on login
Date: Tue, 22 Aug 2023 12:02:53 +0200 [thread overview]
Message-ID: <20230822100253.544220-1-rhi@pengutronix.de> (raw)
When logging in over a serial line, the default terminal size of 80x24
is assumed by default, which makes e.g. systemctl output scroll sideways
unnecessarily when the serial connection is running inside a larger
terminal on the host. Therefore the first thing I do after login is
usually to call 'resize' (which is enabled by default via busybox) to
determine the real size of the terminal and set the COLUMNS and LINES
environment variables accordingly.
For the sake of convenience, do that automatically when starting a login
shell as it has no downsides. Also wrap it inside an 'eval' call, partly
to silence resize's output, and partly to support shells that cannot
determine the COLUMNS and LINES variables by themselves and rely on it
being set explicitely.
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
projectroot/etc/profile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/projectroot/etc/profile b/projectroot/etc/profile
index 259113d3330d..f8c03b35cd11 100644
--- a/projectroot/etc/profile
+++ b/projectroot/etc/profile
@@ -7,6 +7,9 @@ if [ "$TERM" != "linux" ]; then
stty erase ^H
fi
+# don't only assume a 80x24 terminal
+eval $(resize)
+
# source this file for subsequent shells, too
# (will also be sourced for init-shell)
export ENV=/etc/profile.environment
--
2.39.2
next reply other threads:[~2023-08-22 10:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 10:02 Roland Hieber [this message]
2023-09-01 6:28 ` Michael Olbrich
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=20230822100253.544220-1-rhi@pengutronix.de \
--to=rhi@pengutronix.de \
--cc=ptxdist@pengutronix.de \
/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