Commit Graph

2 Commits

Author SHA1 Message Date
Arnout Vandecappelle
7150edc790 utils/config: fix shellcheck errors
In utils/config line 54:
                ARG="`echo $ARG | tr a-z- A-Z_`"
                     ^------------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.
                           ^--^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
                ARG="$(echo "$ARG" | tr a-z- A-Z_)"

In utils/config line 87:
        local tmpfile="$infile.swp"
              ^-----^ SC2034: tmpfile appears unused. Verify use (or export if used externally).

In utils/config line 182:
                        if [ $? != 0 ] ; then
                             ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.

For more information:
  https://www.shellcheck.net/wiki/SC2034 -- tmpfile appears unused. Verify us...
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
  https://www.shellcheck.net/wiki/SC2006 -- Use $(...) notation instead of le...

The suggestions from shellcheck can be applied.

The unused variable tmpfile in fact occurs in several functions, all of
them can be removed.

For the check exit code, the condition is swapped to avoid negative
logic.

Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
2023-02-08 15:28:30 +01:00
Marcus Folkesson
f2c5c7a263 utils/config: new script to manipulate .config files on the command line
Default prefix is set to `BR2_` but may be overidden by setting
BR2_PREFIX.

Example usage:

Enable `BR2_PACKAGE_GNUPG`:
./utils/config --package --enable GNUPG

Check state of config option `BR2_PACKAGE_GNUPG`:
./utils/config --package --state GNUPG
y

Enable `BR2_PACKAGE_GNUPG`:
./utils/config --package --disable GNUPG

Set `BR2_TARGET_GENERIC_ISSUE` to "Welcome":
./utils/config --set-str  TARGET_GENERIC_ISSUE "Welcome"

Copied from the Linux kernel (4.13-rc6) source code and adapted to
Buildroot.
Thanks to Andi Kleen who is the original author of this script.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
[Arnout: merge the two tr invications]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2017-09-27 22:45:35 +02:00