Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCHv2 2/3] base-files: profile: Do not assume that the tty command exists
Date: Wed,  5 Apr 2017 15:46:41 +0200	[thread overview]
Message-ID: <20170405134642.12572-2-pkj@axis.com> (raw)
In-Reply-To: <20170405134642.12572-1-pkj@axis.com>

This avoids the following error when logging in to a host that does
not have the tty command:

-sh: tty: not found

Reported-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/recipes-core/base-files/base-files/profile   | 6 +++---
 meta/recipes-core/base-files/base-files_3.0.14.bb | 4 ----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile
index 22dfb4f219..ceaf15f799 100644
--- a/meta/recipes-core/base-files/base-files/profile
+++ b/meta/recipes-core/base-files/base-files/profile
@@ -22,12 +22,12 @@ if [ -d /etc/profile.d ]; then
 	unset i
 fi
 
-if [ -x /usr/bin/resize ] && termpath="`tty`"; then
+if command -v resize >/dev/null && command -v tty >/dev/null; then
 	# Make sure we are on a serial console (i.e. the device used starts with
 	# /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which
 	# tries do use ssh
-	case "$termpath" in
-		/dev/tty[A-z]*) resize >/dev/null
+	case $(tty) in
+		/dev/tty[A-z]*) resize >/dev/null;;
 	esac
 fi
 
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 f56969c52e..ca7bf06353 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
@@ -128,10 +128,6 @@ 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
 }
 
-- 
2.12.0



  reply	other threads:[~2017-04-05 13:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 13:46 [PATCHv2 1/3] base-files: profile: Whitespace clean up Peter Kjellerstedt
2017-04-05 13:46 ` Peter Kjellerstedt [this message]
2017-04-11 14:06   ` [PATCHv2 2/3] base-files: profile: Do not assume that the tty command exists Richard Purdie
2017-04-05 13:46 ` [PATCHv2 3/3] base-files: profile: Simplify setting variables conditionally Peter Kjellerstedt
2017-04-05 14:44   ` Richard Purdie
2017-04-06  7:21     ` Peter Kjellerstedt

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=20170405134642.12572-2-pkj@axis.com \
    --to=peter.kjellerstedt@axis.com \
    --cc=openembedded-core@lists.openembedded.org \
    /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