board/qemu: fix shellcheck in post-image script

Commit 270759aff3cf (board/qemu: define start qemu script outside of
post-image script) touches board/qemu/post-image.sh, so that exposed
existing shellcheck issues.

Fix those now.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: James Knight <james.d.knight@live.com>
This commit is contained in:
Yann E. MORIN 2023-04-10 22:37:23 +02:00
parent d9b244d8a3
commit b32d7c99c6

View File

@ -1,8 +1,8 @@
#!/bin/bash
QEMU_BOARD_DIR="$(dirname $0)"
DEFCONFIG_NAME="$(basename $2)"
README_FILES="${QEMU_BOARD_DIR}/*/readme.txt"
QEMU_BOARD_DIR="$(dirname "$0")"
DEFCONFIG_NAME="$(basename "$2")"
README_FILE="${QEMU_BOARD_DIR}/*/readme.txt"
START_QEMU_SCRIPT="${BINARIES_DIR}/start-qemu.sh"
if [[ "${DEFCONFIG_NAME}" =~ ^"qemu_*" ]]; then
@ -12,7 +12,7 @@ fi
# Search for "# qemu_*_defconfig" tag in all readme.txt files.
# Qemu command line on multilines using back slash are accepted.
QEMU_CMD_LINE=$(sed -r ':a; /\\$/N; s/\\\n//; s/\t/ /; ta; /# '${DEFCONFIG_NAME}'$/!d; s/#.*//' ${README_FILES})
QEMU_CMD_LINE="$(sed -r ':a; /\\$/N; s/\\\n//; s/\t/ /; ta; /# '"${DEFCONFIG_NAME}"'$/!d; s/#.*//' \ "${README_FILE}")"
if [ -z "${QEMU_CMD_LINE}" ]; then
# No Qemu cmd line found, can't test.