summaryrefslogtreecommitdiff
path: root/script/vendor
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-12-24 09:04:36 +0000
committerLeah Rowe <leah@libreboot.org>2023-12-24 09:04:36 +0000
commit0aca6332ee5865dbf4717235cbf9f5e8e79dddc3 (patch)
treecbb2a18ec22213208ab3dcaf22eebbb84fb14e5e /script/vendor
parent575332f2219c9e6f435b7ed35bfb2a408de0628c (diff)
lbmk scripts: shorter code lines
while seemingly pedantic, this does actually make code easier to read. mostly just switching to shorthand for variable names, where no expansions or patterns are used Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'script/vendor')
-rwxr-xr-xscript/vendor/download30
-rwxr-xr-xscript/vendor/inject20
2 files changed, 25 insertions, 25 deletions
diff --git a/script/vendor/download b/script/vendor/download
index 25434318..1f96c665 100755
--- a/script/vendor/download
+++ b/script/vendor/download
@@ -30,7 +30,7 @@ main()
[ $# -gt 0 ] || err "No argument given"
board="${1}"
boarddir="${cbcfgsdir}/${board}"
- _b="${board%%_*mb}" # shorthand (avoid duplicating config per rom size)
+ _b="${board%%_*mb}" # shorthand (no duplication per rom size)
check_defconfig "${boarddir}" && exit 0
detect_firmware && exit 0
@@ -162,28 +162,28 @@ extract_intel_me()
[ -f "${_me}" ] && return 0
sdir="$(mktemp -d)"
- mkdir -p "${sdir}" || err "extract_intel_me: !mkdir -p \"${sdir}\""
+ mkdir -p "$sdir" || err "extract_intel_me: !mkdir -p \"$sdir\""
(
- [ "${cdir#/a}" != "${cdir}" ] && cdir="${cdir#/}"
- cd "${cdir}" || err "extract_intel_me: !cd \"${cdir}\""
+ [ "${cdir#/a}" != "$cdir" ] && cdir="${cdir#/}"
+ cd "$cdir" || err "extract_intel_me: !cd \"$cdir\""
for i in *; do
- [ -f "${_me}" ] && break
- [ -L "${i}" ] && continue
- if [ -f "${i}" ]; then
- "${mecleaner}" -r -t -O "${sdir}/vendorfile" \
- -M "${_me}" "${i}" && break
- "${mecleaner}" -r -t -O "${_me}" "${i}" && break
- "${me7updateparser}" -O "${_me}" "${i}" && break
+ [ -f "$_me" ] && break
+ [ -L "$i" ] && continue
+ if [ -f "$i" ]; then
+ "$mecleaner" -r -t -O "${sdir}/vendorfile" \
+ -M "$_me" "$i" && break
+ "$mecleaner" -r -t -O "$_me" "$i" && break
+ "$me7updateparser" -O "$_me" "$i" && break
_7ztest="${_7ztest}a"
- extract_archive "${i}" "${_7ztest}" || continue
- extract_intel_me "${_me}" "${cdir}/${_7ztest}"
+ extract_archive "$i" "$_7ztest" || continue
+ extract_intel_me "$_me" "${cdir}/${_7ztest}"
elif [ -d "$i" ]; then
- extract_intel_me "${_me}" "${cdir}/${i}"
+ extract_intel_me "$_me" "${cdir}/${i}"
else
continue
fi
cdir="${1}"
- [ "${cdir#/a}" != "${cdir}" ] && cdir="${cdir#/}"
+ [ "${cdir#/a}" != "$cdir" ] && cdir="${cdir#/}"
cd "${cdir}" || :
done
)
diff --git a/script/vendor/inject b/script/vendor/inject
index 3f75a9da..cec19b2e 100755
--- a/script/vendor/inject
+++ b/script/vendor/inject
@@ -37,7 +37,7 @@ main()
inject_vendorfiles
[ "${nukemode}" = "nuke" ] && return 0
printf "Friendly reminder (this is *not* an error message):\n"
- printf "Please always ensure that the files were inserted correctly.\n"
+ printf "Please ensure that the files were inserted correctly.\n"
}
check_board()
@@ -96,7 +96,7 @@ build_dependencies()
if [ ! -f "${cbfstool}" ] || [ ! -f "${ifdtool}" ]; then
x_ ./update trees -b coreboot utils default
fi
- [ -z "${new_mac}" ] || [ -f "${nvmutil}" ] || x_ make -C util/nvmutil
+ [ -z "$new_mac" ] || [ -f "$nvmutil" ] || x_ make -C util/nvmutil
[ "${nukemode}" = "nuke" ] && return 0
x_ ./vendor download ${board}
}
@@ -116,7 +116,7 @@ patch_release_roms()
_tmpdir="tmp/romdir"
remkdir "${_tmpdir}"
tar -xf "${archive}" -C "${_tmpdir}" || \
- err "patch_release_roms: !tar -xf \"${archive}\" -C \"${_tmpdir}\""
+ err "patch_release_roms: !tar -xf \"$archive\" -C \"$_tmpdir\""
for x in "${_tmpdir}"/bin/*/*.rom ; do
printf "patching rom: %s\n" "$x"
@@ -208,20 +208,20 @@ inject()
fi
if [ "${cbfsname}" = "IFD" ]; then
if [ "${nukemode}" != "nuke" ]; then
- "${ifdtool}" -i ${_t}:${_dest} "${rom}" -O "$rom" || \
+ "$ifdtool" -i ${_t}:${_dest} "$rom" -O "$rom" || \
err "inject: can't insert $_t ($dest) into $rom"
else
- "${ifdtool}" --nuke ${_t} "${rom}" -O "${rom}" || \
- err "inject ${rom}: can't nuke ${_t} in IFD"
+ "$ifdtool" --nuke $_t "$rom" -O "$rom" || \
+ err "inject $rom: can't nuke $_t in IFD"
fi
else
if [ "${nukemode}" != "nuke" ]; then
- "${cbfstool}" "${rom}" add -f "${_dest}" \
- -n "${cbfsname}" -t ${_t} ${_offset} || \
+ "$cbfstool" "$rom" add -f "$_dest" \
+ -n "$cbfsname" -t $_t $_offset || \
err "inject $rom: can't insert $_t file $_dest"
else
- "${cbfstool}" "${rom}" remove -n "${cbfsname}" || \
- err "inject $rom: can't remove ${cbfsname}"
+ "$cbfstool" "$rom" remove -n "$cbfsname" || \
+ err "inject $rom: can't remove $cbfsname"
fi
fi