build: rename option(s) to package(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.

So referring to packages instead of options makes it easier to
understand what the script is doing.

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 00:30:04 +01:00 committed by Adrien 'neox' Bourmault
parent 23981d7096
commit 37800705ab
Signed by: neox
GPG Key ID: 2974E1D5F25DFCC8
1 changed files with 13 additions and 13 deletions

26
build
View File

@ -36,15 +36,15 @@ listmodes() {
} }
# Takes exactly one mode as parameter # Takes exactly one mode as parameter
listoptions() { list_packages() {
for option in "${build}"/"${1}"/*; do for package in "${build}"/"${1}"/*; do
printf '%s\n' "${option##*/}" printf '%s\n' "${package##*/}"
done done
} }
help() { help() {
cat <<- EOF cat <<- EOF
USAGE: ./build <MODE> <OPTION> USAGE: ./build <MODE> <PACKAGE>
possible values for 'mode': possible values for 'mode':
$(listmodes) $(listmodes)
@ -77,26 +77,26 @@ fi
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
option="${2}" package="${2}"
shift 2 shift 2
case "${option}" in case "${package}" in
list) list)
printf "Available options for mode '%s':\n\n" "${mode}" printf "Available packages for mode '%s':\n\n" "${mode}"
listoptions "${mode}" list_packages "${mode}"
;; ;;
all) all)
for option in $(listoptions "${mode}"); do for package in $(list_packages "${mode}"); do
"${build}"/"${mode}"/"${option}" $@ "${build}"/"${mode}"/"${package}" $@
done done
;; ;;
*) *)
if [ -d "${build}"/"${mode}"/ ]; then if [ -d "${build}"/"${mode}"/ ]; then
if [ -f "${build}"/"${mode}"/"${option}" ]; then if [ -f "${build}"/"${mode}"/"${package}" ]; then
"${build}"/"${mode}"/"${option}" $@ "${build}"/"${mode}"/"${package}" $@
else else
help help
die "Invalid option for '${mode}'." \ die "Invalid package for '${mode}'." \
" See './build ${mode} list'." " See './build ${mode} list'."
fi fi
else else