From 8d9aeef3de28bcb908e33b804517bdeacce7be38 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 20 Oct 2023 00:17:30 +0100 Subject: lbmk: use 2-level directory structure in script/ as opposed to the current 3-level structure. recent build system simplifications have enabled this change, thus: ./build fw coreboot -> ./build roms ./build fw grub -> ./build grub ./build fw serprog -> ./build serprog ./update project release -> ./update release ./update project trees -> ./update trees ./update vendor download -> ./vendor download ./update vendor inject -> ./vendor inject alper criticised that the commands were too long, so i made them shorter! Signed-off-by: Leah Rowe --- build | 46 +++++++++++++++------------------------------- 1 file changed, 15 insertions(+), 31 deletions(-) (limited to 'build') diff --git a/build b/build index 09b08403..80ee1827 100755 --- a/build +++ b/build @@ -11,7 +11,7 @@ set -u -e . "include/err.sh" . "include/option.sh" -eval "$(setvars "" mode option aur_notice tmpdir)" +eval "$(setvars "" option aur_notice tmpdir)" tmpdir_was_set="y" set | grep TMPDIR 1>/dev/null 2>/dev/null || tmpdir_was_set="n" @@ -39,8 +39,10 @@ buildpath="./script/${linkname}" main() { xx_ id -u 1>/dev/null 2>/dev/null - initialise_command $@ - shift 2 + [ $# -lt 1 ] && fail "Too few arguments. Try: ${0} help" + [ "${1}" = "dependencies" ] && xx_ install_packages $@ && lbmk_exit 0 + + initialise_command $@ && shift 1 check_git check_project "fail" @@ -51,22 +53,13 @@ main() initialise_command() { - [ $# -lt 1 ] && fail "Too few arguments. Try: ${0} help" - - mode="${1}" - [ "${mode}" != "dependencies" ] || xx_ install_packages $@ [ "$(id -u)" != "0" ] || fail "this command as root is not permitted" - [ "${mode}" = "help" ] && usage ${0} && lbmk_exit 0 - if [ "${mode}" = "list" ]; then - items "${buildpath}" - lbmk_exit 0 - elif [ $# -lt 2 ]; then - usage ${0} - lbmk_exit 1 - fi - - option="${2}" + case "${1}" in + help) usage ${0} && lbmk_exit 0 ;; + list) items "${buildpath}" && lbmk_exit 0 ;; + esac + option="${1}" } install_packages() @@ -83,16 +76,13 @@ install_packages() . "config/dependencies/${2}" xx_ ${pkg_add} ${pkglist} - [ "${aur_notice}" = "" ] || \ - printf "You must install AUR packages: %s\n" "${aur_notice}" 1>&2 - - lbmk_exit 0 + [ -z "${aur_notice}" ] && return 0 + printf "You must install AUR packages: %s\n" "${aur_notice}" 1>&2 } execute_command() { - [ "$option" = "list" ] && xx_ items "$buildpath/$mode" && lbmk_exit 0 - lbmkcmd="${buildpath}/${mode}/${option}" + lbmkcmd="${buildpath}/${option}" [ -f "${lbmkcmd}" ] || fail "Invalid command. Run: ${linkpath} help" "${lbmkcmd}" $@ || fail "execute_command: ${lbmkcmd} ${@}" } @@ -101,17 +91,11 @@ usage() { progname=${0} cat <<- EOF - USAGE: ${progname}