From f9131f86820c4af1ee3f691dd8514fad20e8897d Mon Sep 17 00:00:00 2001 From: Rezart Qelibari Date: Tue, 5 Apr 2022 16:14:34 +0200 Subject: [PATCH] Add possiblity to check only runtime dependencies --- modules/lib.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/lib.sh b/modules/lib.sh index 3c95ac5..b7c6a68 100644 --- a/modules/lib.sh +++ b/modules/lib.sh @@ -29,10 +29,11 @@ function getModuleAnswerByKeyRegEx() { function checkCommands() { local cmd - for cmd in ${(k)cmds}; do + local varName=$1 + for cmd in ${(Pk)varName}; do if ! which "${cmd}" >&! /dev/null; then local comment='' - [ -n "${cmds[$cmd]}" ] && comment=" ${cmds[$cmd]}" + [ -n "${${(P)varName}[$cmd]}" ] && comment=" ${${(P)varName}[$cmd]}" lop -- -e "This module needs ${cmd}${comment} to work." return 11 fi @@ -51,10 +52,11 @@ function module_main() { local cmdName=${1:t} shift autoloadZShLib || return - checkPrerequisites || return + checkPrerequisites cmds || return configureLogging eval "`getUsage $cmdName | docopts -f -V - -h - : "$@"`" [ $# -lt 1 ] && return [ "${show_questions}" = true ] && { showQuestions; return } + checkPrerequisites execCmds || return configure_system }