diff options
author | Leah Rowe <leah@libreboot.org> | 2023-08-27 14:14:49 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-08-27 14:24:20 +0100 |
commit | 9457d6be52e5f409566dabc10dd5435102b2e760 (patch) | |
tree | 175385fc7d0922e0ea0a318a90d5e7f0a4731f56 /lbmk | |
parent | 93d2dcad2d8b03eab613404e8c7c4209f250c70d (diff) |
unified list command for all scripts
e.g. ./build boot roms list
./update blobs inject listboards
./build boot list
./build clean list
also this is now possible:
./build list
or maybe
./update list
^ would list directories in resources/scripts/build
and resources/scripts/update respectively
this script is added:
resources/scripts/build/command/options
call it like so, e.g.
./build command options resources/coreboot
this script is now used, for list functions in
other scripts.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'lbmk')
-rwxr-xr-x | lbmk | 35 |
1 files changed, 6 insertions, 29 deletions
@@ -48,6 +48,8 @@ main() ./.gitcheck || err "/.gitcheck call from main, in /lbmk" [ "${mode}" = "help" ] && usage ${0} && exit 0 + [ "${mode}" = "list" ] && ./build command options "${buildpath}" && \ + exit 0 [ $# -lt 2 ] && usage ${0} && exit 1 if [ "${mode}" = "dependencies" ]; then @@ -63,10 +65,10 @@ main() case "${option}" in list) - printf "Options for mode '%s':\n\n" ${mode} - listoptions "${mode}" ;; + ./build command options "${buildpath}/${mode}" ;; all) - for option in $(listoptions "${mode}"); do + for option in $(./build command options "${buildpath}/${mode}") + do "${buildpath}/${mode}/${option}" $@ || \ err "script fail: ${buildpath}/${mode}/${option} $@" done @@ -99,19 +101,6 @@ install_dependencies() printf "You must install AUR packages: %s\n" "${aur_notice}" 1>&2 } -# Takes exactly one mode as parameter -listoptions() -{ - options="n" - for option in "${buildpath}/${1}/"*; do - [ -f "${option}" ] || continue - printf '%s\n' ${option##*/} - options="y" - done - [ "${options}" = "y" ] || \ - err "listoptions: No scripts present in directory ${buildpath}/${1}" -} - usage() { progname=${0} @@ -119,7 +108,7 @@ usage() USAGE: ${progname} <MODE> <OPTION> possible values for 'mode': - $(listmodes) + $(./build command options "${buildpath}/${mode}") Example: ${progname} module all Example: ${progname} module flashrom [static] @@ -130,16 +119,4 @@ usage() EOF } -listmodes() -{ - modes="n" - for mode in "${buildpath}"/*; do - [ -d "${mode}" ] || continue - printf '%s\n' ${mode##*/} - modes="y" - done - [ "${modes}" = "y" ] || \ - err "listmodes: No directories present in directory ${buildpath}" -} - main $@ |