lbmk: don't use status for unconditional returns

in cases where lbmk must always return from a function,
there are some cases where it relies on non-zero exit
status, which in practise is always the case, but may
change in the future if the relevant part is modified

e.g. do_something && return 0

the proper form is:
do_something
return 0

also do this for unconditional exits

Signed-off-by: Leah Rowe <leah@libreboot.org>
btrfsvols
Leah Rowe 2023-11-08 06:31:04 +00:00
parent 64f9337470
commit 5af3ae0586
5 changed files with 27 additions and 12 deletions

View File

@ -31,8 +31,12 @@ main()
{ {
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case ${1} in case ${1} in
help) usage && exit 0 ;; help)
list) items config/coreboot && exit 0 ;; usage
exit 0 ;;
list)
items config/coreboot || :
exit 0 ;;
-d) _displaymode="${2}" ;; -d) _displaymode="${2}" ;;
-p) _payload="${2}" ;; -p) _payload="${2}" ;;
-k) _keyboard="${2}" ;; -k) _keyboard="${2}" ;;
@ -216,10 +220,11 @@ build_target()
build_roms() build_roms()
{ {
cbcfg="${1}" cbcfg="${1}"
[ ! -f "${cbcfg}" ] && \ if [ ! -f "${cbcfg}" ]; then
printf "'%s' does not exist. Skipping build for %s %s %s\n" \ printf "'%s' does not exist. Skipping build for %s %s %s\n" \
"${cbcfg}" "${board}" "${displaymode}" "${initmode}" \ "${cbcfg}" "${board}" "${displaymode}" "${initmode}" 1>&2
1>&2 && return 0 return 0
fi
x_ ./update trees -b coreboot ${board} x_ ./update trees -b coreboot ${board}

View File

@ -34,7 +34,10 @@ main()
x_ mkdir -p "bin/serprog_${platform}" x_ mkdir -p "bin/serprog_${platform}"
if [ $# -gt 1 ] ; then if [ $# -gt 1 ] ; then
[ "${2}" = "list" ] && print_boards ${boards_dir} && return 0 if [ "${2}" = "list" ]; then
print_boards ${boards_dir}
return 0
fi
build_${platform}_rom "${2}" build_${platform}_rom "${2}"
else else
printf "Building all serprog targets\n" printf "Building all serprog targets\n"

View File

@ -37,8 +37,11 @@ main()
[ -z "${_f}" ] && err "missing flag (-m/-u/-b/-c/-x/-f/-s/-l/-n)" [ -z "${_f}" ] && err "missing flag (-m/-u/-b/-c/-x/-f/-s/-l/-n)"
[ -z "${project}" ] && err "project name not specified" [ -z "${project}" ] && err "project name not specified"
[ -f "config/${project}/build.list" ] && build_targets $@ && return 0 if [ -f "config/${project}/build.list" ]; then
build_targets $@
else
build_projects $@ build_projects $@
fi
} }
build_projects() build_projects()

View File

@ -140,8 +140,10 @@ vendor_checksum()
mkdirs() mkdirs()
{ {
[ -f "${1}" ] && \ if [ -f "${1}" ]; then
printf "mkdirs ${1} ${2}: already downloaded\n" 1>&2 && return 1 printf "mkdirs ${1} ${2}: already downloaded\n" 1>&2
return 1
fi
mkdir -p "${1%/*}" || err "mkdirs: !mkdir -p ${1%/*}" mkdir -p "${1%/*}" || err "mkdirs: !mkdir -p ${1%/*}"
x_ rm -Rf "${appdir}" x_ rm -Rf "${appdir}"
x_ mkdir -p "${appdir}/" x_ mkdir -p "${appdir}/"

View File

@ -14,8 +14,10 @@ eval "$(setvars "" archive rom modifygbe nukemode release new_mac)"
main() main()
{ {
[ $# -lt 1 ] && err "No options specified." [ $# -lt 1 ] && err "No options specified."
[ "${1}" = "listboards" ] && \ if [ "${1}" = "listboards" ]; then
items config/coreboot && exit 0 items config/coreboot || :
exit 0
fi
archive="${1}" archive="${1}"