diff options
author | Leah Rowe <leah@libreboot.org> | 2023-12-24 09:04:36 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-12-24 09:04:36 +0000 |
commit | 0aca6332ee5865dbf4717235cbf9f5e8e79dddc3 (patch) | |
tree | cbb2a18ec22213208ab3dcaf22eebbb84fb14e5e /include | |
parent | 575332f2219c9e6f435b7ed35bfb2a408de0628c (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 'include')
-rwxr-xr-x | include/err.sh | 2 | ||||
-rwxr-xr-x | include/git.sh | 9 | ||||
-rwxr-xr-x | include/mrc.sh | 6 | ||||
-rwxr-xr-x | include/option.sh | 2 |
4 files changed, 10 insertions, 9 deletions
diff --git a/include/err.sh b/include/err.sh index 1aeebcbb..3c596b17 100755 --- a/include/err.sh +++ b/include/err.sh @@ -29,7 +29,7 @@ check_git() git_err() { - printf "You need to set git name/email, like so:\n%s\n\n" "${1}" 1>&2 + printf "You need to set git name/email, like so:\n%s\n\n" "$1" 1>&2 fail "Git name/email not configured" || \ err "Git name/email not configured" } diff --git a/include/git.sh b/include/git.sh index 274b5f3f..6184ba0c 100755 --- a/include/git.sh +++ b/include/git.sh @@ -51,12 +51,13 @@ load_target_config() . "${cfgsdir}/${1}/target.cfg" || \ err "load_target_config ${cfgsdir}/${1}: cannot load config" - touch "${cfgsdir}/${1}/seen" || err "load_config $cfgsdir/$1: !mk seen" + touch "${cfgsdir}/${1}/seen" || \ + err "load_config $cfgsdir/$1: !mk seen" } prepare_new_tree() { - printf "Creating %s tree %s (%s)\n" "${project}" "${tree}" "${_target}" + printf "Creating %s tree %s (%s)\n" "$project" "$tree" "$_target" remkdir "${tmp_git_dir%/*}" cp -R "src/${project}/${project}" "${tmp_git_dir}" || \ @@ -121,7 +122,7 @@ clone_project() git_reset_rev() { git -C "${1}" reset --hard ${2} || err "!git reset ${1} <- ${2}" - if [ "${project}" != "coreboot" ] && [ "${project}" != "u-boot" ] && \ + if [ "$project" != "coreboot" ] && [ "$project" != "u-boot" ] && \ [ -f "${1}/.gitmodules" ]; then git -C "${1}" submodule update --init --checkout || \ err "git_reset_rev ${1}: can't download submodules" @@ -137,7 +138,7 @@ git_am_patches() [ -f "${patch}" ] || continue git -C "${sdir}" am "${patch}" || patchfail="y" [ "${patchfail}" != "y" ] && continue - git -C "${sdir}" am --abort || err "${sdir}: !git am --abort" + git -C "$sdir" am --abort || err "$sdir: !git am --abort" err "!git am ${patch} -> ${sdir}" done for patches in "${patchdir}/"*; do diff --git a/include/mrc.sh b/include/mrc.sh index 5ac09792..6a9b0a12 100755 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -8,7 +8,7 @@ eval "$(setvars "" MRC_url MRC_url_bkup MRC_hash MRC_board SHELLBALL)" extract_mrc() { - [ -z "${MRC_board}" ] && err "extract_mrc $MRC_hash: MRC_board not set" + [ -z "$MRC_board" ] && err "extract_mrc $MRC_hash: MRC_board not set" [ -z "${CONFIG_MRC_FILE}" ] && \ err "extract_mrc $MRC_hash: CONFIG_MRC_FILE not set" @@ -21,7 +21,7 @@ extract_mrc() ) || err "mrc download/extract failure" "${cbfstool}" "${appdir}/"bios.bin extract -n mrc.bin \ - -f "${_dest}" -r RO_SECTION || err "extract_mrc: cbfstool ${_dest}" + -f "$_dest" -r RO_SECTION || err "extract_mrc: cbfstool $_dest" } extract_partition() @@ -38,5 +38,5 @@ extract_partition() err "extract_partition, dd ${1%.zip}, root-a.ext2" printf "cd /usr/sbin\ndump chromeos-firmwareupdate ${SHELLBALL}\nquit" \ - | debugfs "root-a.ext2" || err "extract_mrc: can't extract shellball" + | debugfs "root-a.ext2" || err "can't extract shellball" } diff --git a/include/option.sh b/include/option.sh index c9845a03..31411423 100755 --- a/include/option.sh +++ b/include/option.sh @@ -52,7 +52,7 @@ scan_config() done << EOF $(eval "awk '${awkstr}' \"${revfile}\"") EOF - rm -f "${revfile}" || "${_fail}" "scan_config: Cannot remove tmpfile" + rm -f "$revfile" || "$_fail" "scan_config: Cannot remove tmpfile" } check_defconfig() |