From 58f235e232b6396097affb0e4328a29d8c16175f Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Sun, 29 Sep 2013 03:13:09 +0000 Subject: Implement more plugin config file parameters --- minimunin | 53 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/minimunin b/minimunin index ce7a857..c42ce59 100755 --- a/minimunin +++ b/minimunin @@ -321,28 +321,47 @@ get_sys() { LANG=C LC_ALL=C ${SYSCTL} -n $@ } -env_for_plugin_from_config() { - unset in_sect - while read line; do - case ${line## } in - \[*\]) case [$1 in ${line%%]*}) in_sect=true;; *) unset in_sect ;; esac - ;; - env.*) [ "${in_sect}" ] || continue - _pref=${line#*env.}; - printf "%s " ${_pref%% *}=\'${_pref#* }\' - ;; - esac - done -} - call_plugin() { _param=$2 _plug=`/usr/bin/find ${PLUGIN_DIR} \( -type l -or -type f \) -perm +111 -name $1 2>/dev/null | /usr/bin/head -n 1` [ -z "${_plug}" ] && return 1 - _env=$( printf "%s\n" "${CONFIGS}" | env_for_plugin_from_config $1 ) - eval env ${_env} ${_plug} ${_param} - return $? + unset in_sect _env _user _command + while read line; do + case ${line## } in + \[*\]) case [$1 in ${line%%]*}) in_sect=true;; *) unset in_sect ;; esac + ;; + env.*) [ "${in_sect}" ] || continue + _pref=${line#*env.} + _env="${env} ${_pref%% *}='${_pref#* }'" + ;; + user ) _user=${line#*user } + ;; + command ) _command=${line#*command } + ;; + esac + done <