mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-20 05:36:23 +02:00
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>
This commit is contained in:
@@ -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 $@
|
||||
|
||||
Reference in New Issue
Block a user