base-files: board_detect: Address shellcheck warnings
authorAndreas Gnau <[email protected]>
Wed, 8 Oct 2025 21:09:26 +0000 (23:09 +0200)
committerHauke Mehrtens <[email protected]>
Tue, 25 Nov 2025 20:51:25 +0000 (21:51 +0100)
 * SC2166 (warning): Prefer [ p ] && [ q ] as [ p -a q ] is not well
   defined.
 * SC2086 (info): Double quote to prevent globbing and word splitting.
 * SC2091 (warning): Remove surrounding $() to avoid executing output
   (or use eval if intentional).

Signed-off-by: Andreas Gnau <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20831
Signed-off-by: Hauke Mehrtens <[email protected]>
package/base-files/files/bin/board_detect

index 94f45bec53a70a9a53fefc53e00c3279511e9f3c..4c50a6057d475cf2eb26bc0524d099659360b5e6 100755 (executable)
@@ -4,11 +4,11 @@ CFG=$1
 
 [ -n "$CFG" ] || CFG=/etc/board.json
 
-[ -d "/etc/board.d/" -a ! -s "$CFG" ] && {
+if [ -d "/etc/board.d/" ] && [ ! -s "$CFG" ]; then
        for a in $(ls /etc/board.d/*); do
-               [ -s $a ] || continue;
-               $(. $a)
+               [ -s "$a" ] || continue
+               (. "$a")
        done
-}
+fi
 
 [ -s "$CFG" ] || return 1