resources: grub: config: (ab)use shellcheck to check it.

While the grub configuration file format is very different from real
shell scripts, the similarities are enough to make it pass shellcheck
with very few adjustements.

The advantage of using shellcheck here is that we can still detect
some issues such as variables that are referenced but not assigned.

For instance if we add 'echo "$test"' in the beginning of the
configuration file we then have:
    In resources/grub/config/grub.cfg line 24:
    echo "$test"
          ^---^ SC2154 (warning): test is referenced but not assigned
          (for output from commands, use "$(test ...)" ).

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: Adrien 'neox' Bourmault <neox@gnu.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2024-12-13 14:58:48 +01:00 committed by Adrien 'neox' Bourmault
parent 4e61be9dec
commit 3faff837dd
Signed by: neox
GPG Key ID: 57BC26A3687116F6
2 changed files with 5 additions and 0 deletions

View File

@ -1,3 +1,4 @@
# shellcheck disable=SC2148 # Does not check for #!
# Copyright (C) 2013, 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> # Copyright (C) 2013, 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
# Copyright (C) 2013-2016, 2020-2021 Leah Rowe <leah@libreboot.org> # Copyright (C) 2013-2016, 2020-2021 Leah Rowe <leah@libreboot.org>
# Copyright (C) 2021 Vitali64 <vitali64pmemail@protonmail.com> # Copyright (C) 2021 Vitali64 <vitali64pmemail@protonmail.com>
@ -16,6 +17,9 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# shellcheck disable=SC2121 # warn against set var=val
# shellcheck disable=SC1036 # error: invalid '('
# shellcheck disable=SC1088 # error: invalid uses of parentheses
set prefix=(memdisk)/boot/grub set prefix=(memdisk)/boot/grub
insmod at_keyboard insmod at_keyboard

View File

@ -46,6 +46,7 @@ run_shellcheck \
download \ download \
modify \ modify \
update \ update \
resources/grub/config/grub.cfg \
resources/packages/coreboot/distclean \ resources/packages/coreboot/distclean \
resources/packages/descriptors/distclean \ resources/packages/descriptors/distclean \
resources/packages/grub/distclean \ resources/packages/grub/distclean \