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:59:39 +0100
commit5db679c9173df1435a4437a6ac3eb24874309974 (patch)
tree6fcf473f0fa3313a49f2ac664fbaed80543c25cb /scripts
parent1085192e8e8c127e170f0ef13d97a21192f57cb7 (diff)
downloadpoky-5db679c9173df1435a4437a6ac3eb24874309974.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. (From OE-Core rev: a5aa5065d5ebe9f320cb1415c6ff4d5d5772f630) 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 69c33049c7..b06880c9cb 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -14,7 +14,7 @@ die() {
14 14
15[ -n "$BUILDDIR" ] || die "The build directory (BUILDDIR) must be set!" 15[ -n "$BUILDDIR" ] || die "The build directory (BUILDDIR) must be set!"
16 16
17if [ "$1" = '--help' -o "$1" = '-h' ]; then 17if [ "$1" = '--help' ] || [ "$1" = '-h' ]; then
18 echo 'Usage: oe-setup-builddir' 18 echo 'Usage: oe-setup-builddir'
19 echo '' 19 echo ''
20 echo "OpenEmbedded setup-builddir - setup build directory $BUILDDIR" 20 echo "OpenEmbedded setup-builddir - setup build directory $BUILDDIR"
@@ -32,19 +32,19 @@ mkdir -p "$BUILDDIR/conf"
32chmod -st "$BUILDDIR" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR" 32chmod -st "$BUILDDIR" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR"
33chmod -st "$BUILDDIR/conf" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR/conf" 33chmod -st "$BUILDDIR/conf" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR/conf"
34 34
35cd "$BUILDDIR" 35cd "$BUILDDIR" || die "Failed to change directory to $BUILDDIR!"
36 36
37if [ -f "$BUILDDIR/conf/templateconf.cfg" -a -z "$TEMPLATECONF" ]; then 37if [ -z "$TEMPLATECONF" ] && [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then
38 TEMPLATECONF=$(cat "$BUILDDIR/conf/templateconf.cfg") 38 TEMPLATECONF=$(cat "$BUILDDIR/conf/templateconf.cfg")
39 # The following two are no longer valid; unsetting them will automatically get them replaced 39 # The following two are no longer valid; unsetting them will automatically get them replaced
40 # with correct ones. 40 # with correct ones.
41 if [ $TEMPLATECONF = "meta/conf" -o $TEMPLATECONF = "meta-poky/conf" ]; then 41 if [ "$TEMPLATECONF" = meta/conf ] || [ "$TEMPLATECONF" = meta-poky/conf ]; then
42 unset TEMPLATECONF 42 unset TEMPLATECONF
43 rm $BUILDDIR/conf/templateconf.cfg 43 rm "$BUILDDIR/conf/templateconf.cfg"
44 fi 44 fi
45fi 45fi
46 46
47. "$OEROOT"/.templateconf 47. "$OEROOT/.templateconf"
48 48
49# 49#
50# $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf 50# $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
@@ -58,8 +58,8 @@ if [ -n "$TEMPLATECONF" ]; then
58 [ -d "$TEMPLATECONF" ] || 58 [ -d "$TEMPLATECONF" ] ||
59 die "TEMPLATECONF value points to nonexistent directory '$TEMPLATECONF'" 59 die "TEMPLATECONF value points to nonexistent directory '$TEMPLATECONF'"
60 fi 60 fi
61 templatesdir=$(python3 -c "import sys; print(sys.argv[1].strip('/').split('/')[-2])" $TEMPLATECONF) 61 templatesdir=$(python3 -c "import sys; print(sys.argv[1].strip('/').split('/')[-2])" "$TEMPLATECONF")
62 if [ ! -f "$TEMPLATECONF/../../layer.conf" -o $templatesdir != "templates" ]; then 62 if [ "$templatesdir" != templates ] || [ ! -f "$TEMPLATECONF/../../layer.conf" ]; then
63 die "TEMPLATECONF value (which is $TEMPLATECONF) must point to meta-some-layer/conf/templates/template-name" 63 die "TEMPLATECONF value (which is $TEMPLATECONF) must point to meta-some-layer/conf/templates/template-name"
64 fi 64 fi
65 OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample" 65 OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
@@ -111,7 +111,7 @@ unset OECORELOCALCONF
111unset OECORELAYERCONF 111unset OECORELAYERCONF
112 112
113# Ending the first-time run message. Show the YP Documentation banner. 113# Ending the first-time run message. Show the YP Documentation banner.
114if [ ! -z "$SHOWYPDOC" ]; then 114if [ -n "$SHOWYPDOC" ]; then
115 cat <<EOM 115 cat <<EOM
116The Yocto Project has extensive documentation about OE including a reference 116The Yocto Project has extensive documentation about OE including a reference
117manual which can be found at: 117manual which can be found at: