modify: 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 01:48:43 +01:00 committed by Adrien 'neox' Bourmault
parent a77228d7af
commit f85c91beab
Signed by: neox
GPG Key ID: 2974E1D5F25DFCC8
1 changed files with 19 additions and 19 deletions

38
modify
View File

@ -28,13 +28,13 @@ projectname="$(cat projectname)"
modify=./resources/scripts/modify modify=./resources/scripts/modify
listmodes() { list_packages() {
for mode in "${modify}"/*; do for package in "${modify}"/*; 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 "${modify}"/"${1}"/*; do for option in "${modify}"/"${1}"/*; do
printf '%s\n' "${option##*/}" printf '%s\n' "${option##*/}"
@ -43,10 +43,10 @@ listoptions() {
help() { help() {
cat <<- EOF cat <<- EOF
USAGE: ./modify <MODE> <OPTION> USAGE: ./modify <PACKAGE> <OPTION>
possible values for 'mode': possible values for 'package':
$(listmodes) $(list_packages)
Example: ./modify coreboot configs Example: ./modify coreboot configs
Example: ./modify coreboot configs x60 Example: ./modify coreboot configs x60
@ -64,9 +64,9 @@ if [ $# -lt 1 ]; then
die "Wrong number of arguments specified. See './modify help'." die "Wrong number of arguments specified. See './modify 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
@ -75,26 +75,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
"${modify}"/"${mode}"/"${option}" $@ "${modify}"/"${package}"/"${option}" $@
done done
;; ;;
*) *)
if [ -d "${modify}"/"${mode}"/ ]; then if [ -d "${modify}"/"${package}"/ ]; then
if [ -f "${modify}"/"${mode}"/"${option}" ]; then if [ -f "${modify}"/"${package}"/"${option}" ]; then
"${modify}"/"${mode}"/"${option}" $@ "${modify}"/"${package}"/"${option}" $@
else else
help help
die "Invalid option for '${mode}'." \ die "Invalid option for '${package}'." \
" See './modify ${mode} list'." " See './modify ${package} list'."
fi fi
else else
help help
die "Invalid mode '${mode}'. See './modify help'." die "Invalid package '${package}'. See './modify help'."
fi fi
esac esac
else else