From 74c48a881df378a83e261c2785012609d81d801e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 27 Sep 2023 21:46:20 +0100 Subject: move build/command/options to include/option.sh Signed-off-by: Leah Rowe --- include/option.sh | 18 ++++++++++++++++++ lbmk | 7 ++++--- script/build/boot/roms | 7 ++++--- script/build/command/options | 30 ------------------------------ script/handle/make/config | 3 ++- script/update/blobs/inject | 3 ++- script/update/project/trees | 3 ++- 7 files changed, 32 insertions(+), 39 deletions(-) create mode 100755 include/option.sh delete mode 100755 script/build/command/options diff --git a/include/option.sh b/include/option.sh new file mode 100755 index 00000000..1f4f290f --- /dev/null +++ b/include/option.sh @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: MIT +# SPDX-FileCopyrightText: 2023 Leah Rowe + +listitems() +{ + rval=1 + [ ! -d "${1}" ] && \ + printf "listitems: directory '%s' doesn't exist" "${1}" && \ + return 1 + for x in "${1}/"*; do + # -e used because this is for files *or* directories + [ -e "${x}" ] || continue + [ "${x##*/}" = "build.list" ] && continue + printf "%s\n" "${x##*/}" 2>/dev/null + rval=0 + done + return ${rval} +} diff --git a/lbmk b/lbmk index eac6afca..395cd130 100755 --- a/lbmk +++ b/lbmk @@ -10,6 +10,7 @@ set -u -e . "include/err.sh" . "include/export.sh" +. "include/option.sh" read projectname < projectname linkpath="${0}" @@ -45,7 +46,7 @@ initialise_command() fail "running this command as root is not permitted" [ "${mode}" = "help" ] && usage ${0} && lbmk_exit 0 - [ "${mode}" = "list" ] && ./build command options "${buildpath}" && \ + [ "${mode}" = "list" ] && listitems "${buildpath}" && \ lbmk_exit 0 [ $# -lt 2 ] && usage ${0} && lbmk_exit 1 @@ -78,7 +79,7 @@ install_packages() execute_command() { if [ "${option}" = "list" ]; then - ./build command options "${buildpath}/${mode}" || \ + listitems "${buildpath}/${mode}" || \ fail "execute_command: cannot list command options" lbmk_exit 0 fi @@ -95,7 +96,7 @@ usage() USAGE: ${progname}