1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 13:29:49 +00:00

base-files: profile: Avoid using "command" to determine if programs exist

Since the existence of "command" in itself is not guaranteed, using it
to determine if other executables exist is moot. Instead just run the
executables and let the shell determine if they exist. By piping stderr
to /dev/null we avoid unnecessary warnings in case they do not exist.

(From OE-Core rev: ba8510deb73e07f17be051fa15a91731ec10382f)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Peter Kjellerstedt
2018-07-19 20:19:40 +02:00
committed by Richard Purdie
parent f931b6fbcb
commit 543dd8e171
@@ -20,14 +20,16 @@ if [ -d /etc/profile.d ]; then
unset i unset i
fi fi
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
# 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
# /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which # use ssh
# tries do use ssh case $(tty 2>/dev/null) in
case $(tty) in # The first invocation of resize verifies that it exists, the second
/dev/tty[A-z]*) resize >/dev/null;; # does the actual resizing. This is due to that resize uses stderr to
esac # determine the size of the tty, which does not work if it is redirected
fi # to /dev/null.
/dev/tty[A-z]*) resize >/dev/null 2>&1 && resize >/dev/null;;
esac
export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM