[Buildroot] [git commit] g-ir-scanner-qemuwrapper.in: Fix shellcheck warnings, switch to sh

Arnout Vandecappelle (Essensium/Mind) arnout at mind.be
Sat Sep 11 18:50:27 UTC 2021


commit: https://git.buildroot.net/buildroot/commit/?id=e1c4eeab73de03bb4cbc1786c7be99613bc33e50
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

- Add double quotes to prevent globbing and word splitting.
  - Add indentations of continuation lines.
  - Disable SC2181 and SC2016 as we explicitly do not want the variables
    expanded in the echo.

Signed-off-by: Adam Duskett <aduskett at gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
---
 .../gobject-introspection/g-ir-scanner-qemuwrapper.in    | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/package/gobject-introspection/g-ir-scanner-qemuwrapper.in b/package/gobject-introspection/g-ir-scanner-qemuwrapper.in
index c76553515e..85f0750b4d 100644
--- a/package/gobject-introspection/g-ir-scanner-qemuwrapper.in
+++ b/package/gobject-introspection/g-ir-scanner-qemuwrapper.in
@@ -1,19 +1,21 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
 GOI_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:}.libs:$(dirname "$0")/../lib:$(dirname "$0")/../../lib"
 
-# Pass -r to qemu-user as to trick glibc into not errorings out if the host kernel
+# Pass -r to qemu-user as to trick glibc into not erroring out if the host kernel
 # is older than the target kernel.
 # Use a modules directory which does not exist so we don't load random things
 # which may then get deleted (or their dependencies) and potentially segfault
-GIO_MODULE_DIR=$(dirname $0)/../lib/gio/modules-dummy \
+GIO_MODULE_DIR="$(dirname "$0")/../lib/gio/modules-dummy" \
 @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \
--L $(dirname $0)/../../ \
--E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \
-"$@"
+    -L "$(dirname "$0")/../../" \
+    -E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \
+    "$@"
 
-if [[ $? -ne 0 ]]; then
+# shellcheck disable=SC2181
+if [ $? -ne 0 ]; then
     echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help."
+    # shellcheck disable=SC2016
     echo 'Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"'
     exit 1
 fi


More information about the buildroot mailing list