From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Sat, 02 Sep 2023 12:42:37 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qcO5O-000xoq-Bc for lore@lore.pengutronix.de; Sat, 02 Sep 2023 12:42:37 +0200 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1qc6xw-0001R9-TG; Fri, 01 Sep 2023 18:25:48 +0200 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1qc4kB-0000R5-6E; Fri, 01 Sep 2023 16:03:27 +0200 Received: from [2a0a:edc0:0:1101:1d::54] (helo=dude05.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qbxeM-0035nF-Vl; Fri, 01 Sep 2023 08:28:58 +0200 Received: from mol by dude05.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1qbxeM-008aeN-2B; Fri, 01 Sep 2023 08:28:58 +0200 Date: Fri, 1 Sep 2023 08:28:58 +0200 From: Michael Olbrich To: Roland Hieber , ptxdist@pengutronix.de Message-ID: Mail-Followup-To: Roland Hieber , ptxdist@pengutronix.de References: <20230822100253.544220-1-rhi@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230822100253.544220-1-rhi@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain Subject: Re: [ptxdist] [PATCH] rootfs: resize terminal on login X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false 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 > --- > 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 |