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