From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Tue, 22 Aug 2023 12:03:43 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) 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 1qYOEi-004c4p-Ue for lore@lore.pengutronix.de; Tue, 22 Aug 2023 12:03:43 +0200 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1qYOEh-000353-7h; Tue, 22 Aug 2023 12:03:43 +0200 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qYOE8-00034T-RU; Tue, 22 Aug 2023 12:03:08 +0200 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qYOE8-000maW-70; Tue, 22 Aug 2023 12:03:08 +0200 Received: from rhi by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1qYOE7-002Klh-0u; Tue, 22 Aug 2023 12:03:07 +0200 From: Roland Hieber To: ptxdist@pengutronix.de Date: Tue, 22 Aug 2023 12:02:53 +0200 Message-Id: <20230822100253.544220-1-rhi@pengutronix.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Mail-Followup-To: Roland Hieber , ptxdist@pengutronix.de Content-Transfer-Encoding: 8bit Subject: [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 Cc: Roland Hieber 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.ext.pengutronix.de); SAEximRunCond expanded to false 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) + # source this file for subsequent shells, too # (will also be sourced for init-shell) export ENV=/etc/profile.environment -- 2.39.2