aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/base-files
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2017-04-03 14:48:27 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-05-16 14:08:15 +0100
commitd76c68505c36dbf383a989f3c2458abc765e2c19 (patch)
tree3d3644d4e7dc13e17209ba2a2569b8eb2253b910 /meta/recipes-core/base-files
parent0bf875ea234bb9ff50d347345782e14d6b7d3ff9 (diff)
downloadopenembedded-core-contrib-d76c68505c36dbf383a989f3c2458abc765e2c19.tar.gz
base-files: profile: Simplify setting variables conditionally
It is preferred to use `[ "$FOO" ] || ...` instead of `[ -z "$FOO" ] && ...` as the latter leaves $? set to 1. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/recipes-core/base-files')
-rw-r--r--meta/recipes-core/base-files/base-files/profile14
1 files changed, 6 insertions, 8 deletions
diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile
index ceaf15f799..a062028226 100644
--- a/meta/recipes-core/base-files/base-files/profile
+++ b/meta/recipes-core/base-files/base-files/profile
@@ -3,15 +3,13 @@
PATH="/usr/local/bin:/usr/bin:/bin"
EDITOR="vi" # needed for packages like cron, git-commit
-test -z "$TERM" && TERM="vt100" # Basic terminal capab. For screen etc.
+[ "$TERM" ] || TERM="vt100" # Basic terminal capab. For screen etc.
-if [ "$HOME" = "ROOTHOME" ]; then
- PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
-fi
-if [ "$PS1" ]; then
- # works for bash and ash (no other shells known to be in use here)
- PS1='\u@\h:\w\$ '
-fi
+# Add /sbin & co to $PATH for the root user
+[ "$HOME" != "ROOTHOME" ] || PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
+
+# Set the prompt for bash and ash (no other shells known to be in use here)
+[ -z "$PS1" ] || PS1='\u@\h:\w\$ '
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do