Patchwork [v3] base-files: set dynamic COLUMNS via resize command

login
register
mail settings
Submitter Ting Liu
Date July 31, 2014, 10:21 a.m.
Message ID <1406802061-11405-1-git-send-email-ting.liu@freescale.com>
Download mbox | patch
Permalink /patch/77021/
State Accepted
Commit 73c481d2cbc3e7c7ef9f594126aec581ec75b689
Headers show

Comments

Ting Liu - July 31, 2014, 10:21 a.m.
From: Ting Liu <ting.liu@freescale.com>

By default, COLUMNS is set to 80. If possible, run 'resize' to
determine what the current dimensions are. This avoids the final
part of long lines overlap the start of the same line.

Signed-off-by: Ting Liu <ting.liu@freescale.com>
---
changes in v2:
* dynamically check for ${bindir} instead of hard code /usr/bin
changes in v3:
* use consistent indentation 

 meta/recipes-core/base-files/base-files/profile   |    4 ++++
 meta/recipes-core/base-files/base-files_3.0.14.bb |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

Patch

diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile
index 0b2d9d7..88ab8d8 100644
--- a/meta/recipes-core/base-files/base-files/profile
+++ b/meta/recipes-core/base-files/base-files/profile
@@ -26,6 +26,10 @@  if [ -d /etc/profile.d ]; then
   unset i
 fi
 
+if [ -x /usr/bin/resize ];then
+  /usr/bin/resize >/dev/null
+fi
+
 export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
 
 umask 022
diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
index 30b1bf4..07f5c54 100644
--- a/meta/recipes-core/base-files/base-files_3.0.14.bb
+++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
@@ -102,6 +102,10 @@  do_install () {
 	install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
 	install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
 
+	if [ "/usr/bin" != "${bindir}" ]; then
+		sed -i "s,/usr/bin/resize,${bindir}/resize," ${D}${sysconfdir}/profile
+	fi
+
 	ln -sf /proc/mounts ${D}${sysconfdir}/mtab
 }