diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2018-07-19 20:19:40 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-26 13:16:40 +0100 |
commit | 543dd8e171f8028edd66965ffeb9fdbd9f1ad80e (patch) | |
tree | 5dd95e638318d0daa5bf8f467bf1485d0019bf3f /meta | |
parent | f931b6fbcb0d564eeda05ea0857f2e3f27b65077 (diff) | |
download | poky-543dd8e171f8028edd66965ffeb9fdbd9f1ad80e.tar.gz |
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>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-core/base-files/base-files/profile | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile index a062028226..e14cb2d878 100644 --- a/meta/recipes-core/base-files/base-files/profile +++ b/meta/recipes-core/base-files/base-files/profile | |||
@@ -20,14 +20,16 @@ if [ -d /etc/profile.d ]; then | |||
20 | unset i | 20 | unset i |
21 | fi | 21 | fi |
22 | 22 | ||
23 | if command -v resize >/dev/null && command -v tty >/dev/null; then | 23 | # Make sure we are on a serial console (i.e. the device used starts with |
24 | # Make sure we are on a serial console (i.e. the device used starts with | 24 | # /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which tries do |
25 | # /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which | 25 | # use ssh |
26 | # tries do use ssh | 26 | case $(tty 2>/dev/null) in |
27 | case $(tty) in | 27 | # The first invocation of resize verifies that it exists, the second |
28 | /dev/tty[A-z]*) resize >/dev/null;; | 28 | # does the actual resizing. This is due to that resize uses stderr to |
29 | esac | 29 | # determine the size of the tty, which does not work if it is redirected |
30 | fi | 30 | # to /dev/null. |
31 | /dev/tty[A-z]*) resize >/dev/null 2>&1 && resize >/dev/null;; | ||
32 | esac | ||
31 | 33 | ||
32 | export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM | 34 | export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM |
33 | 35 | ||