summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-12-23 16:16:26 +0000
committerLeah Rowe <leah@libreboot.org>2023-12-23 17:51:32 +0000
commit655d3cdc881f72d2fdd0797ad92edae2f36ac73e (patch)
tree1b93dd5c3ea6ccc88af19871cabf9d9028cc6131 /build
parent25f9d9480fb61e0dd860560d46d8d433565aeb01 (diff)
lbmk scripts: general code cleanup/optimisation
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'build')
-rwxr-xr-xbuild21
1 files changed, 8 insertions, 13 deletions
diff --git a/build b/build
index e06c1cea..ac6db677 100755
--- a/build
+++ b/build
@@ -37,22 +37,16 @@ main()
{
xx_ id -u 1>/dev/null 2>/dev/null
[ $# -lt 1 ] && fail "Too few arguments. Try: ${0} help"
- if [ "${1}" = "dependencies" ]; then
- xx_ install_packages $@
- lbmk_exit 0
- fi
-
- initialise_command $@ && shift 1
- check_git
- check_project
- git_init
+ [ "${1}" = "dependencies" ] && xx_ install_packages $@ && lbmk_exit 0
- execute_command $@
+ for cmd in initcmd check_git check_project git_init excmd; do
+ eval "${cmd} \$@"
+ done
lbmk_exit 0
}
-initialise_command()
+initcmd()
{
[ "$(id -u)" != "0" ] || fail "this command as root is not permitted"
@@ -104,11 +98,12 @@ git_init()
fail "${PWD}: cannot git-tag ${projectname}/${version}"
}
-execute_command()
+excmd()
{
lbmkcmd="${buildpath}/${option}"
+ echo "TEST: $lbmkcmd"
[ -f "${lbmkcmd}" ] || fail "Invalid command. Run: ${linkpath} help"
- "${lbmkcmd}" $@ || fail "execute_command: ${lbmkcmd} ${@}"
+ shift 1; "$lbmkcmd" $@ || fail "excmd: ${lbmkcmd} ${@}"
}
usage()