mirror of
https://github.com/limosek/zaf.git
synced 2024-11-23 19:09:08 +01:00
Repaired ctrl functions (from trunk)
This commit is contained in:
parent
c830d0e6a0
commit
45a072024c
@ -22,7 +22,7 @@ zaf_ctrl_get_item_block() {
|
||||
# Get global plugin block body from stdin
|
||||
# $1 itemname
|
||||
zaf_ctrl_get_global_block() {
|
||||
grep -v '^#' | awk '{ i=0;
|
||||
grep -v '^#' | awk '{ i=0; print $0;
|
||||
while (i==0) {
|
||||
getline;
|
||||
if (/^Item /) exit;
|
||||
@ -33,7 +33,7 @@ zaf_ctrl_get_global_block() {
|
||||
# Get item multiline option
|
||||
# $1 optionname
|
||||
zaf_block_get_moption() {
|
||||
awk '/^'$1'::$/ { i=0;
|
||||
awk '/^'$1'::$/ { i=0; print $0;
|
||||
while (i==0) {
|
||||
getline;
|
||||
if (/^::$/) {i=1; continue;};
|
||||
@ -218,16 +218,13 @@ zaf_ctrl_generate_cfg() {
|
||||
$(which echo) "UserParameter=$ikey,${ZAF_LIB_DIR}/preload.sh $cache $lock$cmd";
|
||||
continue
|
||||
fi
|
||||
cmd=$(zaf_ctrl_get_item_option $1 $i "Function")
|
||||
if [ -n "$cmd" ]; then
|
||||
$(which echo) "UserParameter=$ikey,${ZAF_LIB_DIR}/preload.sh $cache $lock$cmd";
|
||||
continue;
|
||||
fi
|
||||
cmd=$(zaf_ctrl_get_item_option $1 $i "Script")
|
||||
if [ -n "$cmd" ]; then
|
||||
zaf_ctrl_get_item_option $1 $i "Script" >${ZAF_TMP_DIR}/${iscript}.sh;
|
||||
zaf_ctrl_get_item_option $1 $i "Script" | \
|
||||
zaf_far '{INCLUDES}' '. /etc/zaf.conf; . ${ZAF_LIB_DIR}/zaf.lib.sh; . ${ZAF_LIB_DIR}/ctrl.lib.sh; . ${ZAF_LIB_DIR}/zbxapi.lib.sh; . ${ZAF_LIB_DIR}/cache.lib.sh; ' \
|
||||
>${ZAF_TMP_DIR}/${iscript}.sh;
|
||||
zaf_install_bin ${ZAF_TMP_DIR}/${iscript}.sh ${ZAF_PLUGINS_DIR}/$2/
|
||||
$(which echo) "UserParameter=$ikey,${ZAF_LIB_DIR}/preload.sh $cache $lock${ZAF_PLUGINS_DIR}/$2/${iscript}.sh $args";
|
||||
$(which echo) "UserParameter=$ikey,$cache $lock${ZAF_PLUGINS_DIR}/$2/${iscript}.sh $args";
|
||||
continue;
|
||||
fi
|
||||
zaf_err "Item $i declared in control file but has no Cmd, Function or Script!"
|
||||
|
Loading…
Reference in New Issue
Block a user