From 9457d6be52e5f409566dabc10dd5435102b2e760 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 27 Aug 2023 14:14:49 +0100 Subject: 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 --- fetch_trees | 12 +++-------- lbmk | 35 ++++++--------------------------- resources/scripts/build/boot/roms | 23 +++++++--------------- resources/scripts/build/command/options | 31 +++++++++++++++++++++++++++++ resources/scripts/handle/make/config | 10 +++------- resources/scripts/update/blobs/inject | 13 ++---------- 6 files changed, 52 insertions(+), 72 deletions(-) create mode 100755 resources/scripts/build/command/options diff --git a/fetch_trees b/fetch_trees index d61eb102..3c33beb0 100755 --- a/fetch_trees +++ b/fetch_trees @@ -51,17 +51,11 @@ main() [ -d "${cfgsdir}" ] || err "unsupported project name" shift 1 - targets="" - if [ $# -gt 0 ]; then - targets=$@ - else - for x in "${cfgsdir}/"*; do - [ -d "${x}" ] || continue - targets="${targets} ${x##*/}" - done - fi + targets=$(./build command options "${cfgsdir}") + [ $# -gt 0 ] && targets=$@ [ -z "${targets}" ] && \ err "No targets available for project: ${project}" + for x in ${targets}; do rm -f "${cfgsdir}"/*/seen || err_rm_seen "main 2" download_for_target "${x}" || \ diff --git a/lbmk b/lbmk index 7cd69ed5..22099e37 100755 --- a/lbmk +++ b/lbmk @@ -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}