build: rename mode(s) to task(s).

Most GNU Boot users are interested in running GNU/Linux or BSD
operating systems. And the way to install software on these
operating systems is through a package manager. So most users and
contributors already know the package manager abstraction.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: Adrien 'neox' Bourmault <neox@gnu.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2023-11-27 01:03:03 +01:00 committed by Adrien 'neox' Bourmault
parent c9b194409d
commit 12a200fc18
Signed by: neox
GPG Key ID: 2974E1D5F25DFCC8
1 changed files with 20 additions and 20 deletions

40
build
View File

@ -29,13 +29,13 @@ projectname="$(cat projectname)"
build=./resources/scripts/build build=./resources/scripts/build
listmodes() { list_tasks() {
for mode in "${build}"/*; do for task in "${build}"/*; do
printf '%s\n' "${mode##*/}" printf '%s\n' "${task##*/}"
done done
} }
# Takes exactly one mode as parameter # Takes exactly one task as parameter
list_packages() { list_packages() {
for package in "${build}"/"${1}"/*; do for package in "${build}"/"${1}"/*; do
printf '%s\n' "${package##*/}" printf '%s\n' "${package##*/}"
@ -44,10 +44,10 @@ list_packages() {
help() { help() {
cat <<- EOF cat <<- EOF
USAGE: ./build <MODE> <PACKAGE> USAGE: ./build <TASK> <PACKAGE>
possible values for 'mode': possible values for 'task':
$(listmodes) $(list_tasks)
Example: ./build module all Example: ./build module all
Example: ./build module flashrom [static] Example: ./build module flashrom [static]
@ -67,13 +67,13 @@ if [ $# -lt 1 ]; then
die "Wrong number of arguments specified. See './build help'." die "Wrong number of arguments specified. See './build help'."
fi fi
mode="${1}" task="${1}"
if [ "${mode}" != "dependencies" ]; then if [ "${task}" != "dependencies" ]; then
./resources/scripts/misc/versioncheck ./resources/scripts/misc/versioncheck
fi fi
[ "${mode}" = help ] && help && exit 0 [ "${task}" = help ] && help && exit 0
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
@ -82,26 +82,26 @@ if [ $# -gt 1 ]; then
case "${package}" in case "${package}" in
list) list)
printf "Available packages for mode '%s':\n\n" "${mode}" printf "Available packages for task '%s':\n\n" "${task}"
list_packages "${mode}" list_packages "${task}"
;; ;;
all) all)
for package in $(list_packages "${mode}"); do for package in $(list_packages "${task}"); do
"${build}"/"${mode}"/"${package}" $@ "${build}"/"${task}"/"${package}" $@
done done
;; ;;
*) *)
if [ -d "${build}"/"${mode}"/ ]; then if [ -d "${build}"/"${task}"/ ]; then
if [ -f "${build}"/"${mode}"/"${package}" ]; then if [ -f "${build}"/"${task}"/"${package}" ]; then
"${build}"/"${mode}"/"${package}" $@ "${build}"/"${task}"/"${package}" $@
else else
help help
die "Invalid package for '${mode}'." \ die "Invalid package for '${task}'." \
" See './build ${mode} list'." " See './build ${task} list'."
fi fi
else else
help help
die "Invalid mode '${mode}'." \ die "Invalid task '${task}'." \
" See './build help'." " See './build help'."
fi fi
esac esac