base-files: profile: Do not assume that the tty command exists

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>
(From OE-Core rev: e77cdb761169e404556487ac650dc562000da406)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Peter Kjellerstedt 2017-04-03 14:48:26 +02:00 committed by Richard Purdie
parent 227ec4809d
commit 16b822509a
2 changed files with 3 additions and 7 deletions

View 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

View 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
}