diff options
| author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2022-09-06 16:58:53 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-09-08 14:59:39 +0100 |
| commit | 5db679c9173df1435a4437a6ac3eb24874309974 (patch) | |
| tree | 6fcf473f0fa3313a49f2ac664fbaed80543c25cb /scripts | |
| parent | 1085192e8e8c127e170f0ef13d97a21192f57cb7 (diff) | |
| download | poky-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-x | scripts/oe-setup-builddir | 18 |
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 | ||
| 17 | if [ "$1" = '--help' -o "$1" = '-h' ]; then | 17 | if [ "$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" | |||
| 32 | chmod -st "$BUILDDIR" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR" | 32 | chmod -st "$BUILDDIR" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR" |
| 33 | chmod -st "$BUILDDIR/conf" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR/conf" | 33 | chmod -st "$BUILDDIR/conf" 2>/dev/null || echo "WARNING: unable to chmod $BUILDDIR/conf" |
| 34 | 34 | ||
| 35 | cd "$BUILDDIR" | 35 | cd "$BUILDDIR" || die "Failed to change directory to $BUILDDIR!" |
| 36 | 36 | ||
| 37 | if [ -f "$BUILDDIR/conf/templateconf.cfg" -a -z "$TEMPLATECONF" ]; then | 37 | if [ -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 |
| 45 | fi | 45 | fi |
| 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 | |||
| 111 | unset OECORELAYERCONF | 111 | unset 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. |
| 114 | if [ ! -z "$SHOWYPDOC" ]; then | 114 | if [ -n "$SHOWYPDOC" ]; then |
| 115 | cat <<EOM | 115 | cat <<EOM |
| 116 | The Yocto Project has extensive documentation about OE including a reference | 116 | The Yocto Project has extensive documentation about OE including a reference |
| 117 | manual which can be found at: | 117 | manual which can be found at: |
