Add noninteractive arg to install.sh

This commit is contained in:
T. R. Bernstein
2024-06-28 15:40:46 +02:00
committed by T. R. Bernstein
parent aa4becfaaf
commit e55f199829

View File

@@ -61,6 +61,7 @@ function installModules() {
filterPasswordOptions filterPasswordOptions
[[ "${verbose}" == true ]] && moduleOptions+=(-v) [[ "${verbose}" == true ]] && moduleOptions+=(-v)
[[ -n ${logfile} ]] && moduleOptions+=(-d ${logfile}) [[ -n ${logfile} ]] && moduleOptions+=(-d ${logfile})
[[ -n ${noninteractive} ]] && moduleOptions+=(--noninteractive)
lop -- -d "Running ${mod}" -d "with ${#moduleOptions} args:" -d "${filteredOptions}" lop -- -d "Running ${mod}" -d "with ${#moduleOptions} args:" -d "${filteredOptions}"
runModule ${mod} ${moduleOptions} runModule ${mod} ${moduleOptions}
done done
@@ -114,6 +115,8 @@ function main() {
-l, --list List modules that are going to be installed and -l, --list List modules that are going to be installed and
exit without installation. Modules are printed in exit without installation. Modules are printed in
minimal but still distinct paths. minimal but still distinct paths.
--noninteractive Run the installation noninteractively. In this case
a config file must be provided.
-d FILE, --logfile FILE Print log message to logfile instead of stdout. -d FILE, --logfile FILE Print log message to logfile instead of stdout.
-v, --verbose Be more verbose. -v, --verbose Be more verbose.
--config-only PATH Ask module questions, generate config at PATH and --config-only PATH Ask module questions, generate config at PATH and
@@ -130,6 +133,8 @@ function main() {
lop -- -d "Current working dir is: `pwd`" lop -- -d "Current working dir is: `pwd`"
lop -- -d "Called main with $# args: $*" lop -- -d "Called main with $# args: $*"
[[ -n ${noninteractive} && -z ${config} ]] && { lop -- -e 'A config file must be provided in noninteractive mode.'; return 10 }
modpath+=("${_DIR}/modules") modpath+=("${_DIR}/modules")
loadModules -v modulesToInstall ${$(echo -m):^^modpath} "${module[@]}" loadModules -v modulesToInstall ${$(echo -m):^^modpath} "${module[@]}"
[ "${list}" = true ] && printModulesToInstall [ "${list}" = true ] && printModulesToInstall