diff options
author | Leah Rowe <leah@libreboot.org> | 2023-10-07 05:36:52 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-10-07 05:37:11 +0100 |
commit | 4708da2ca9a72520f39749b3b34b0bdc2fbfa15d (patch) | |
tree | 8c7f436fc53d10665f150e295d2d488b3f86e729 /script/update/project | |
parent | 0fad3497b82d9225468835d1b27717050ca6de46 (diff) |
use quotes when checking empty strings in scripts
this is far less error-prone
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'script/update/project')
-rwxr-xr-x | script/update/project/build | 14 | ||||
-rwxr-xr-x | script/update/project/trees | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/script/update/project/build b/script/update/project/build index 57e95953..2d457485 100755 --- a/script/update/project/build +++ b/script/update/project/build @@ -33,8 +33,8 @@ main() esac shift; project="${OPTARG#src/}"; shift done - [ -z ${_f} ] && err "flag not specified (-m, -u, -b, -c or -x)" - [ -z ${project} ] && err "project name not specified" + [ -z "${_f}" ] && err "flag not specified (-m, -u, -b, -c or -x)" + [ -z "${project}" ] && err "project name not specified" if [ ! -f "config/${project}/build.list" ]; then build_projects $@ @@ -80,7 +80,7 @@ build_targets() err "Cannot get options for ${cfgsdir}" [ $# -gt 0 ] && targets=$@ - [ -z ${mode} ] && x_ mkdir -p "${elfdir}/" + [ -z "${mode}" ] && x_ mkdir -p "${elfdir}/" handle_targets } @@ -97,7 +97,7 @@ handle_targets() done [ "${target1}" = "utils" ] && [ "${project}" = "coreboot" ] && return 0 - [ -z ${mode} ] || return 0 + [ -z "${mode}" ] || return 0 printf "Done! The files are stored under %s/\n\n" "${elfdir}" } @@ -138,9 +138,9 @@ handle_src_tree() # Override the above defaults using target.cfg . "${target_dir}/target.cfg" # source - [ -z ${tree} ] && \ + [ -z "${tree}" ] && \ err "handle_src_tree: ${target_dir}: tree undefined" - [ -z ${arch} ] && \ + [ -z "${arch}" ] && \ err "handle_src_tree: ${target_dir}: undefined cpu type" codedir="src/${project}/${tree}" @@ -260,7 +260,7 @@ run_make_command() { [ -f "${codedir}/Makefile" ] || [ -f "${codedir}/makefile" ] || \ [ -f "${codedir}/GNUmakefile" ] || return 1 - [ "${project}" = "coreboot" ] && [ -z ${mode} ] && \ + [ "${project}" = "coreboot" ] && [ -z "${mode}" ] && \ x_ printf "%s\n" "${version}" >"${codedir}/.coreboot-version" x_ make -C "${codedir}" -j$(nproc) ${mode} diff --git a/script/update/project/trees b/script/update/project/trees index 4b25d5b9..f38101c6 100755 --- a/script/update/project/trees +++ b/script/update/project/trees @@ -66,8 +66,8 @@ fetch_config() err "fetch_config: no \"${cfgsdir}/${_target}/target.cfg\"" [ "${_target}" != "${tree}" ] && _target="${tree}" && continue - [ -z ${tree} ] && err "${_xm}: tree undefined" - [ -z ${rev} ] && err "${_xm}: revision undefined" + [ -z "${tree}" ] && err "${_xm}: tree undefined" + [ -z "${rev}" ] && err "${_xm}: revision undefined" break done } |