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>btrfsvols
parent
54ca5f24d2
commit
1eb4df6748
|
@ -36,23 +36,23 @@ git_err()
|
|||
|
||||
check_project()
|
||||
{
|
||||
read projectname < projectname || :
|
||||
read -r projectname < projectname || :
|
||||
|
||||
[ ! -f version ] || read version < version || :
|
||||
[ ! -f version ] || read -r version < version || :
|
||||
version_="${version}"
|
||||
[ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \
|
||||
version="git-$(git rev-parse HEAD 2>&1)" || version="${version_}"
|
||||
|
||||
[ ! -f versiondate ] || read versiondate < versiondate || :
|
||||
[ ! -f versiondate ] || read -r versiondate < versiondate || :
|
||||
versiondate_="${versiondate}"
|
||||
[ ! -e ".git" ] || versiondate="$(git show --no-patch --no-notes \
|
||||
--pretty='%ct' HEAD)" || versiondate="${versiondate_}"
|
||||
|
||||
[ ! -z ${versiondate} ] || fail "Unknown version date" || \
|
||||
[ -n "${versiondate}" ] || fail "Unknown version date" || \
|
||||
err "Unknown version date"
|
||||
[ ! -z ${version} ] || fail "Unknown version" || \
|
||||
[ -n "${version}" ] || fail "Unknown version" || \
|
||||
err "Unknown version"
|
||||
[ ! -z ${projectname} ] || fail "Unknown project" || \
|
||||
[ -n "${projectname}" ] || fail "Unknown project" || \
|
||||
err "Unknown project"
|
||||
|
||||
xx_ printf "%s\n" "${version}" > version || \
|
||||
|
|
|
@ -123,7 +123,7 @@ clone_project()
|
|||
[ "${patchfail}" = "y" ] && err "PATCH FAIL"
|
||||
|
||||
x_ rm -Rf "${loc}"
|
||||
[ "${loc}" = "${loc%/*}" ] || x_ mkdir -p ${loc%/*}
|
||||
[ "${loc}" = "${loc%/*}" ] || x_ mkdir -p "${loc%/*}"
|
||||
mv "${tmp_git_dir}" "${loc}" || \
|
||||
err "clone_project: !mv ${tmp_git_dir} ${loc}"
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ build_keymap_configs()
|
|||
{
|
||||
for keylayoutfile in "${grubcfgsdir}/keymap/"*.gkb; do
|
||||
[ -f "${keylayoutfile}" ] || continue
|
||||
keymap="${keylayoutfile##${grubcfgsdir}/keymap/}"
|
||||
keymap="${keylayoutfile##"${grubcfgsdir}/keymap/"}"
|
||||
keymap="${keymap%.gkb}"
|
||||
printf "keymap %s\n" "${keymap}" > \
|
||||
"${elfdir}/keymap_${keymap}.cfg" || err "!insert keymap"
|
||||
|
|
|
@ -64,7 +64,7 @@ main()
|
|||
|
||||
[ -z "${targets}" ] && err "No ROM images were compiled"
|
||||
printf "\nROM images available in these directories:\n"
|
||||
printf "${targets}^^ ROM images available in these directories.\n\n"
|
||||
printf "%s^^ ROM images available in these directories.\n\n" "${targets}"
|
||||
|
||||
printf "DO NOT flash ROM images from elf/ - please use bin/ instead.\n"
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ build_roms()
|
|||
|
||||
_cbrom="elf/coreboot_nopayload_DO_NOT_FLASH/${board}/${initmode}_${displaymode}"
|
||||
[ "${initmode}" = "normal" ] && \
|
||||
_cbrom="${_cbrom%_${displaymode}}"
|
||||
_cbrom="${_cbrom%"_${displaymode}"}"
|
||||
_cbrom="${_cbrom}/coreboot.rom"
|
||||
cbrom="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
|
||||
x_ cp "${_cbrom}" "${cbrom}"
|
||||
|
@ -349,7 +349,7 @@ mkSeabiosRom() {
|
|||
|
||||
x_ cp "${_cbrom}" "${tmprom}"
|
||||
x_ "${cbfstool}" "${tmprom}" add-payload -f "${_seabioself}" \
|
||||
-n ${_seabios_cbfs_path} -c lzma
|
||||
-n "${_seabios_cbfs_path}" -c lzma
|
||||
x_ "${cbfstool}" "${tmprom}" add-int -i 3000 -n etc/ps2-keyboard-spinup
|
||||
|
||||
z="2"; [ "${initmode}" = "vgarom" ] && z="0"
|
||||
|
@ -405,7 +405,7 @@ mkUbootRom() {
|
|||
|
||||
x_ cp "${_cbrom}" "${tmprom}"
|
||||
x_ "${cbfstool}" "${tmprom}" add-payload -f "${_ubootelf}" \
|
||||
-n ${_uboot_cbfs_path} -c lzma
|
||||
-n "${_uboot_cbfs_path}" -c lzma
|
||||
|
||||
printf "%s\n" "${tmprom}"
|
||||
}
|
||||
|
|
|
@ -50,24 +50,24 @@ main()
|
|||
build_rp2040_rom()
|
||||
{
|
||||
board=${1}
|
||||
printf "Building pico-serprog for ${board}\n"
|
||||
printf "Building pico-serprog for %s\n" "${board}"
|
||||
x_ cmake -DPICO_BOARD="${board}" -DPICO_SDK_PATH="${pico_sdk_dir}" \
|
||||
-B "${pico_src_dir}/build" "${pico_src_dir}"
|
||||
x_ cmake --build "${pico_src_dir}/build"
|
||||
x_ mv ${pico_src_dir}/build/pico_serprog.uf2 \
|
||||
bin/serprog_rp2040/serprog_${board}.uf2
|
||||
printf "output to bin/serprog_rp2040/serprog_${board}.uf2\n"
|
||||
printf "output to bin/serprog_rp2040/serprog_%s.uf2\n" "${board}"
|
||||
}
|
||||
|
||||
build_stm32_rom()
|
||||
{
|
||||
board=${1}
|
||||
printf "Building stm32-vserprog for ${board}\n"
|
||||
printf "Building stm32-vserprog for %s\n" "${board}"
|
||||
x_ make -C ${stm32_src_dir} libopencm3-just-make BOARD=${board}
|
||||
x_ make -C ${stm32_src_dir} BOARD=${board}
|
||||
x_ mv ${stm32_src_dir}/stm32-vserprog.hex \
|
||||
bin/serprog_stm32/serprog_${board}.hex
|
||||
printf "output to bin/serprog_stm32/serprog_${board}.hex\n"
|
||||
printf "output to bin/serprog_stm32/serprog_%s.hex\n" "${board}"
|
||||
}
|
||||
|
||||
print_boards()
|
||||
|
@ -78,7 +78,7 @@ print_boards()
|
|||
|
||||
list_boards()
|
||||
{
|
||||
basename -a -s .h ${1}/*.h
|
||||
basename -a -s .h "${1}/"*.h
|
||||
}
|
||||
|
||||
main $@
|
||||
|
|
|
@ -209,12 +209,12 @@ nukerom()
|
|||
touch "${romdir}/vendorhashes" || err "!touch ${romdir}/vendorhashes"
|
||||
(
|
||||
cd "${romdir}" || err "!cd romdir ${romdir}, nukerom"
|
||||
sha512sum *.rom >> vendorhashes || err "!create vendorhashes, nukerom"
|
||||
sha512sum ./*.rom >> vendorhashes || err "!create vendorhashes, nukerom"
|
||||
) || err "can't create vendor hashes"
|
||||
|
||||
for romfile in "${romdir}"/*.rom; do
|
||||
[ -f "${romfile}" ] || continue
|
||||
./vendor inject -r "${romfile}" -b ${target} -n nuke || \
|
||||
./vendor inject -r "${romfile}" -b "${target}" -n nuke || \
|
||||
err "!vendor inject (nuke) ${romfile}, nukerom"
|
||||
done
|
||||
}
|
||||
|
@ -255,13 +255,13 @@ mkrom_tarball()
|
|||
f="release/${version}/roms/${archivename}"
|
||||
mkdir -p "${f%/*}" || err "mkrom_tarball: !mkdir -p ${f%/*}"
|
||||
(
|
||||
cd "${romdir%/bin/${target}}" || err "!cd ${romdir%/bin/${target}}"
|
||||
cd "${romdir%"/bin/${target}"}" || err "!cd ${romdir%"/bin/${target}"}"
|
||||
mktarball "bin/${target}" "${archivename}.tar.xz"
|
||||
) || err "can't create rom tarball"
|
||||
mv "${romdir%/bin/${target}}/${archivename}.tar.xz"* "${f%/*}" || \
|
||||
err "!mktarball, rom, ${f%/*}/${romdir%/bin/${target}}/${archivename}.tar.xz"
|
||||
mv "${romdir%"/bin/${target}"}/${archivename}.tar.xz"* "${f%/*}" || \
|
||||
err "!mktarball, rom, ${f%/*}/${romdir%"/bin/${target}"}/${archivename}.tar.xz"
|
||||
|
||||
printf "Created ROM archive: ${f%/*}/${archivename}.tar.xz"
|
||||
printf "Created ROM archive: %s" "${f%/*}/${archivename}.tar.xz"
|
||||
}
|
||||
|
||||
insert_version_files()
|
||||
|
|
|
@ -99,7 +99,7 @@ handle_targets()
|
|||
target="${x}"
|
||||
printf "Running 'make %s' for project '%s, target '%s''\n" \
|
||||
"${mode}" "${project}" "${target}"
|
||||
[ "${project}" != "coreboot" ] || [ ! -z ${mode} ] || \
|
||||
[ "${project}" != "coreboot" ] || [ -n "${mode}" ] || \
|
||||
x_ ./vendor download ${target}
|
||||
x_ handle_defconfig
|
||||
done
|
||||
|
@ -121,14 +121,14 @@ handle_defconfig()
|
|||
for y in "${target_dir}/config"/*; do
|
||||
[ -f "${y}" ] || continue
|
||||
config="${y}"
|
||||
config_name="${config#${target_dir}/config/}"
|
||||
config_name="${config#"${target_dir}/config/"}"
|
||||
|
||||
printf "handle/make/config %s %s: handling config %s\n" \
|
||||
"${project}" "${target}" "${config_name}"
|
||||
|
||||
[ ! -z ${mode} ] || check_config || continue
|
||||
[ -n "${mode}" ] || check_config || continue
|
||||
handle_makefile
|
||||
[ ! -z ${mode} ] || copy_elf
|
||||
[ -n "${mode}" ] || copy_elf
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ handle_makefile()
|
|||
{
|
||||
x_ make clean -C "${codedir}"
|
||||
x_ cp "${config}" "${codedir}/.config"
|
||||
[ ! -z ${mode} ] || make -C "${codedir}" silentoldconfig || \
|
||||
[ -n "${mode}" ] || make -C "${codedir}" silentoldconfig || \
|
||||
make -C "${codedir}" oldconfig || :
|
||||
|
||||
run_make_command || err "handle_makefile ${codedir}: no makefile!"
|
||||
|
@ -256,7 +256,7 @@ run_make_command()
|
|||
[ -f "${codedir}/Makefile" ] || [ -f "${codedir}/makefile" ] || \
|
||||
[ -f "${codedir}/GNUmakefile" ] || return 1
|
||||
[ "${project}" = "coreboot" ] && [ -z "${mode}" ] && \
|
||||
x_ printf "%s\n" "${version%%-*}" >"${codedir}/.coreboot-version"
|
||||
x_ printf "%s\n" "${version%%-*}" >"$codedir/.coreboot-version"
|
||||
|
||||
x_ make ${mode} -j$(nproc) -C "${codedir}"
|
||||
|
||||
|
@ -266,10 +266,10 @@ run_make_command()
|
|||
|
||||
copy_elf()
|
||||
{
|
||||
while read f; do
|
||||
while read -r f; do
|
||||
[ ! -f "${codedir}/$f" ] || \
|
||||
x_ cp "${codedir}/${f}" "${dest_dir}/"
|
||||
done < ${listfile}
|
||||
done < "${listfile}"
|
||||
|
||||
x_ make clean -C "${codedir}"
|
||||
}
|
||||
|
|
|
@ -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" || :
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue