fix several shellcheck warnings

lbmk didn't quote certain arguments in commands, or
used ! -z instead of -n, things like that. simple fixes.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2023-12-16 07:56:26 +00:00
parent 54ca5f24d2
commit 1eb4df6748
9 changed files with 43 additions and 42 deletions
+6 -6
View File
@@ -54,7 +54,7 @@ detect_firmware()
build_dependencies()
{
[ -d ${cbdir} ] || \
[ -d "${cbdir}" ] || \
x_ ./update trees -f coreboot ${cbdir##*/}
for d in uefitool biosutilities bios_extract; do
[ -d "src/${d}" ] && continue
@@ -132,7 +132,7 @@ fetch()
vendor_checksum()
{
[ "$(sha512sum ${2} | awk '{print $1}')" != "${1}" ] || return 0
[ "$(sha512sum "${2}" | awk '{print $1}')" != "${1}" ] || return 0
printf "Bad checksum for file: %s\n" "${2}" 1>&2
rm -f "${2}" || :
return 1
@@ -141,7 +141,7 @@ vendor_checksum()
mkdirs()
{
if [ -f "${1}" ]; then
printf "mkdirs ${1} ${2}: already downloaded\n" 1>&2
printf "mkdirs %s %s: already downloaded\n" "${1}" "${2}" 1>&2
return 1
fi
mkdir -p "${1%/*}" || err "mkdirs: !mkdir -p ${1%/*}"
@@ -188,7 +188,7 @@ extract_intel_me()
fi
cdir="${1}"
[ "${cdir#/a}" != "${cdir}" ] && cdir="${cdir#/}"
cd "${cdir}"
cd "${cdir}" || :
done
)
rm -Rf "${sdir}" || err "extract_intel_me: !rm -Rf ${sdir}"
@@ -227,9 +227,9 @@ extract_kbc1126ec()
extract_e6400vga()
{
[ "${E6400_VGA_offset}" = "" ] && \
[ -z "${E6400_VGA_offset}" ] && \
err "extract_e6400vga: E6400 VGA offset not defined"
[ "${E6400_VGA_romname}" = "" ] && \
[ -z "${E6400_VGA_romname}" ] && \
err "extract_e6400vga: E6400 VGA ROM name not defined"
tail -c +${E6400_VGA_offset} "${_dl}" | \
gunzip >"${appdir}/bios.bin" || :
+6 -5
View File
@@ -28,6 +28,7 @@ main()
b) board=${OPTARG} ;;
m) modifygbe=true
new_mac=${OPTARG} ;;
*) : ;;
esac
done
@@ -48,7 +49,7 @@ check_board()
err "check_board: \"${rom}\" is not a valid path"
[ -z "${rom+x}" ] && \
err "check_board: no rom specified"
[ ! -z ${board+x} ] || \
[ -n "${board+x}" ] || \
board=$(detect_board "${rom}")
else
release="y"
@@ -72,7 +73,7 @@ check_release()
detect_board()
{
path="${1}"
filename=$(basename ${path})
filename=$(basename "${path}")
case ${filename} in
grub_*)
board=$(echo "${filename}" | cut -d '_' -f2-3) ;;
@@ -185,12 +186,12 @@ patch_rom()
"${CONFIG_KBC1126_FW1_OFFSET}" && \
inject "ecfw2.bin" "$CONFIG_KBC1126_FW2" "raw" \
"${CONFIG_KBC1126_FW2_OFFSET}"
[ ! -z "${CONFIG_VGA_BIOS_FILE}" ] && \
[ ! -z "${CONFIG_VGA_BIOS_ID}" ] && \
[ -n "${CONFIG_VGA_BIOS_FILE}" ] && \
[ -n "${CONFIG_VGA_BIOS_ID}" ] && \
inject "pci${CONFIG_VGA_BIOS_ID}.rom" \
"${CONFIG_VGA_BIOS_FILE}" "optionrom"
[ "${CONFIG_INCLUDE_SMSC_SCH5545_EC_FW}" = "y" ] && \
[ ! -z "${CONFIG_SMSC_SCH5545_EC_FW_FILE}" ] && \
[ -n "${CONFIG_SMSC_SCH5545_EC_FW_FILE}" ] && \
inject "sch5545_ecfw.bin" "$CONFIG_SMSC_SCH5545_EC_FW_FILE" raw
[ "${modifygbe}" = "true" ] && ! [ "${release}" = "y" ] && \
inject "IFD" "${CONFIG_GBE_BIN_PATH}" "GbE"