summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2022-09-06 16:58:53 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-09-08 14:55:51 +0100
commita5aa5065d5ebe9f320cb1415c6ff4d5d5772f630 (patch)
tree2869e93b5a06a6293347891ffd0b0b237772b887 /scripts
parent670f255bf639ca19a396ee67ec7d78094da2f576 (diff)
downloadopenembedded-core-a5aa5065d5ebe9f320cb1415c6ff4d5d5772f630.tar.gz
oe-setup-builddir: Avoid shellcheck warnings
This avoid the following warnings: * SC2086: Double quote to prevent globbing and word splitting. * SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. * SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. * SC2236: Use -n instead of ! -z. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-setup-builddir18
1 files changed, 9 insertions, 9 deletions
diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index 1c8d2104db..f86b8e90ed 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -14,7 +14,7 @@ die() {
[ -n "$BUILDDIR" ] || die "The build directory (BUILDDIR) must be set!"
-if [ "$1" = '--help' -o "$1" = '-h' ]; then
+if [ "$1" = '--help' ] || [ "$1" = '-h' ]; then
echo 'Usage: oe-setup-builddir'
echo ''
echo "OpenEmbedded setup-builddir - setup build directory $BUILDDIR"
@@ -32,19 +32,19 @@ mkdir -p "$BUILDDIR/conf"
chmod -st "$BUILDDIR" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR"
chmod -st "$BUILDDIR/conf" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR/conf"
-cd "$BUILDDIR"
+cd "$BUILDDIR" || die "Failed to change directory to $BUILDDIR!"
-if [ -f "$BUILDDIR/conf/templateconf.cfg" -a -z "$TEMPLATECONF" ]; then
+if [ -z "$TEMPLATECONF" ] && [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then
TEMPLATECONF=$(cat "$BUILDDIR/conf/templateconf.cfg")
# The following two are no longer valid; unsetting them will automatically get them replaced
# with correct ones.
- if [ $TEMPLATECONF = "meta/conf" -o $TEMPLATECONF = "meta-poky/conf" ]; then
+ if [ "$TEMPLATECONF" = meta/conf ] || [ "$TEMPLATECONF" = meta-poky/conf ]; then
unset TEMPLATECONF
- rm $BUILDDIR/conf/templateconf.cfg
+ rm "$BUILDDIR/conf/templateconf.cfg"
fi
fi
-. "$OEROOT"/.templateconf
+. "$OEROOT/.templateconf"
#
# $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
@@ -58,8 +58,8 @@ if [ -n "$TEMPLATECONF" ]; then
[ -d "$TEMPLATECONF" ] ||
die "TEMPLATECONF value points to nonexistent directory '$TEMPLATECONF'"
fi
- templatesdir=$(python3 -c "import sys; print(sys.argv[1].strip('/').split('/')[-2])" $TEMPLATECONF)
- if [ ! -f "$TEMPLATECONF/../../layer.conf" -o $templatesdir != "templates" ]; then
+ templatesdir=$(python3 -c "import sys; print(sys.argv[1].strip('/').split('/')[-2])" "$TEMPLATECONF")
+ if [ "$templatesdir" != templates ] || [ ! -f "$TEMPLATECONF/../../layer.conf" ]; then
die "TEMPLATECONF value (which is $TEMPLATECONF) must point to meta-some-layer/conf/templates/template-name"
fi
OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
@@ -111,7 +111,7 @@ unset OECORELOCALCONF
unset OECORELAYERCONF
# Ending the first-time run message. Show the YP Documentation banner.
-if [ ! -z "$SHOWYPDOC" ]; then
+if [ -n "$SHOWYPDOC" ]; then
cat <<EOM
The Yocto Project has extensive documentation about OE including a reference
manual which can be found at: