]> code.ossystems Code Review - openembedded-core.git/commitdiff
base-files: profile: Do not assume that the tty command exists
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>
Mon, 3 Apr 2017 12:48:26 +0000 (14:48 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 8 Apr 2017 21:48:04 +0000 (22:48 +0100)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/base-files/base-files/profile
meta/recipes-core/base-files/base-files_3.0.14.bb

index 22dfb4f2197648031dbb8881c765a462b086ce56..ceaf15f799b7771b66865ffe101b61e71fddece4 100644 (file)
@@ -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
 
index f56969c52e95398d9aae40947b66a8d5347e9304..ca7bf06353091e254b3f0d7670983472c31847a6 100644 (file)
@@ -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
 }