update: rename mode(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 02:10:54 +01:00 committed by Adrien 'neox' Bourmault
parent f85c91beab
commit c9b194409d
Signed by: neox
GPG Key ID: 2974E1D5F25DFCC8
1 changed files with 19 additions and 19 deletions

38
update
View File

@ -28,13 +28,13 @@ projectname="$(cat projectname)"
update=./resources/scripts/update update=./resources/scripts/update
listmodes() { list_packages() {
for mode in "${update}"/*; do for package in "${update}"/*; do
printf '%s\n' "${mode##*/}" printf '%s\n' "${package##*/}"
done done
} }
# Takes exactly one mode as parameter # Takes exactly one package as parameter
listoptions() { listoptions() {
for option in "${update}"/"${1}"/*; do for option in "${update}"/"${1}"/*; do
printf '%s\n' "${option##*/}" printf '%s\n' "${option##*/}"
@ -43,10 +43,10 @@ listoptions() {
help() { help() {
cat <<- EOF cat <<- EOF
USAGE: ./update <MODE> <OPTION> USAGE: ./update <PACKAGE> <OPTION>
possible values for 'mode': possible values for 'package':
$(listmodes) $(list_packages)
Example: ./update coreboot configs Example: ./update coreboot configs
Example: ./update coreboot configs x60 Example: ./update coreboot configs x60
@ -64,9 +64,9 @@ if [ $# -lt 1 ]; then
die "Wrong number of arguments specified. See './update help'." die "Wrong number of arguments specified. See './update help'."
fi fi
mode="${1}" package="${1}"
[ "${mode}" = help ] && help && exit 0 [ "${package}" = help ] && help && exit 0
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
option="${2}" option="${2}"
@ -74,26 +74,26 @@ if [ $# -gt 1 ]; then
case "${option}" in case "${option}" in
list) list)
printf "Available options for mode '%s':\n\n" "${mode}" printf "Available options for package '%s':\n\n" "${package}"
listoptions "${mode}" listoptions "${package}"
;; ;;
all) all)
for option in $(listoptions "${mode}"); do for option in $(listoptions "${package}"); do
"${update}"/"${mode}"/"${option}" $@ "${update}"/"${package}"/"${option}" $@
done done
;; ;;
*) *)
if [ -d "${update}"/"${mode}"/ ]; then if [ -d "${update}"/"${package}"/ ]; then
if [ -f "${update}"/"${mode}"/"${option}" ]; then if [ -f "${update}"/"${package}"/"${option}" ]; then
"${update}"/"${mode}"/"${option}" $@ "${update}"/"${package}"/"${option}" $@
else else
help help
die "Invalid option for '${mode}'." \ die "Invalid option for '${package}'." \
" See './update ${mode} list'." " See './update ${package} list'."
fi fi
else else
help help
die "Invalid mode '${mode}'. See './update help'." die "Invalid package '${package}'. See './update help'."
fi fi
esac esac
else else