redhat/configs: Change script interpreter to /bin/bash

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2343226

When running make dist-configs on a system where /bin/sh is dash (rather than bash), the command fails with:

[...]
Building .../redhat/configs/kernel-riscv64-rt-debug-fedora.config ...
Building .../redhat/configs/kernel-riscv64-rt-debug-fedora.config complete
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
./generate_all_configs.sh: 26: Bad substitution
head: cannot open '.../redhat/configs/kernel-6.14.0*.config' for reading: No such file or directory
cat: '.../redhat/configs/kernel-6.14.0*.config': No such file or directory
Processing .../redhat/configs/kernel-6.14.0*.config ...
.../Makefile:750: arch//Makefile: No such file or directory
make[3]: *** No rule to make target 'arch//Makefile'.  Stop.
make[2]: *** [Makefile:263: __sub-make] Error 2
make[1]: *** [Makefile:564: dist-configs] Error 1
make[1]: Leaving directory '.../redhat'
make: *** [makefile:12: dist-configs] Error 2

The problem is due to the following substitution: ${i:$specpackage_name_len}

If we remove the shellcheck ignore, shellcheck explains: SC3057 (warning): In POSIX sh, string indexing is undefined.

Since there are already many other scripts under redhat/ which use /bin/bash as their interpreter, fix this problem by changing the interpreter for this script to use bash as well.

We can then remove the shellcheck ignore but this results in another message: SC2001 (style): See if you can use ${variable//search/replace} instead.

The code is restructured as suggested.

Signed-off-by: Benjamin Poirier bpoirier@redhat.com

Edited by Benjamin Poirier

Merge request reports

Loading