summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-09-16 11:19:15 +0100
committerLeah Rowe <leah@libreboot.org>2023-09-16 11:24:03 +0100
commitf1f5b91a854ec5fe563d934c87126aba2f85d1b9 (patch)
tree6854699ecb74699121a28c77ac591b5e5211dc4e
parent662b9266304463944cda69f1750b00e8a816fbc5 (diff)
lbmk: simplify execute_command()
if ./build command options fails, it just means that lbmk would next check whether ./buildpath mode list exists, which it never will because that would violate lbmk design. the generic "help" output is more than sufficient, and tells the user to check "list" anyway, so there's no point in saying it here. simplify this function. Signed-off-by: Leah Rowe <leah@libreboot.org>
-rwxr-xr-xlbmk20
1 files changed, 7 insertions, 13 deletions
diff --git a/lbmk b/lbmk
index 7cd57cdd..83ed993c 100755
--- a/lbmk
+++ b/lbmk
@@ -93,20 +93,14 @@ install_packages()
execute_command()
{
- case "${option}" in
- list)
- ./build command options "${buildpath}/${mode}" ;;
- *)
- if [ ! -d "${buildpath}/${mode}" ]; then
- usage $0
- fail "Invalid mode '${mode}'. Run: ${0} help"
- elif [ ! -f "${buildpath}/${mode}/${option}" ]; then
- usage $0
- printf "Invalid option for '%s'." ${mode} 1>&2
- fail "Run: ${0} ${mode} list'."
- fi
+ if [ "${option}" = "list" ]; then
+ ./build command options "${buildpath}/${mode}"
+ lbmk_exit 0
+ elif [ ! -f "${buildpath}/${mode}/${option}" ]; then
+ fail "Invalid command. Run: ${linkpath} help"
+ else
"${buildpath}/${mode}/${option}" $@ || fail "lbmk error"
- esac
+ fi
}
usage()