* [ptxdist] [PATCH] rootfs: resize terminal on login
@ 2023-08-22 10:02 Roland Hieber
2023-09-01 6:28 ` Michael Olbrich
0 siblings, 1 reply; 2+ messages in thread
From: Roland Hieber @ 2023-08-22 10:02 UTC (permalink / raw)
To: ptxdist; +Cc: Roland Hieber
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ptxdist] [PATCH] rootfs: resize terminal on login
2023-08-22 10:02 [ptxdist] [PATCH] rootfs: resize terminal on login Roland Hieber
@ 2023-09-01 6:28 ` Michael Olbrich
0 siblings, 0 replies; 2+ messages in thread
From: Michael Olbrich @ 2023-09-01 6:28 UTC (permalink / raw)
To: Roland Hieber, ptxdist
On Tue, Aug 22, 2023 at 12:02:53PM +0200, Roland Hieber wrote:
> 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)
> +
Hmm, I'm not sure if this is something we want to do unconditionally. It's
certainly not needed for ssh logins (or telnet for that matter).
Maybe something like this (untested):
case "$(tty 2>/dev/null)"; in
/dev/pts/*)
;;
*)
eval $(resize) ;;
esac
Michael
> # source this file for subsequent shells, too
> # (will also be sourced for init-shell)
> export ENV=/etc/profile.environment
> --
> 2.39.2
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-02 10:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-22 10:02 [ptxdist] [PATCH] rootfs: resize terminal on login Roland Hieber
2023-09-01 6:28 ` Michael Olbrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox