1
0
mirror of https://github.com/limosek/zaf.git synced 2024-11-23 19:09:08 +01:00
limosek-zaf/lib/preload.sh

51 lines
935 B
Bash
Raw Normal View History

2016-04-01 12:20:23 +02:00
#!/bin/sh
. /etc/zaf.conf
2016-04-01 15:51:45 +02:00
2016-04-21 15:29:48 +02:00
. ${ZAF_LIB_DIR}/zaf.lib.sh
. ${ZAF_LIB_DIR}/plugin.lib.sh
. ${ZAF_LIB_DIR}/ctrl.lib.sh
. ${ZAF_LIB_DIR}/os.lib.sh
. ${ZAF_LIB_DIR}/zbxapi.lib.sh
. ${ZAF_LIB_DIR}/cache.lib.sh
if ! type zaf_version >/dev/null; then
echo "Problem loading libraries?"
exit 2
2016-04-21 15:29:48 +02:00
fi
2016-12-11 21:05:18 +01:00
zaf_debug_init
zaf_tmp_init
zaf_cache_init
2016-04-01 15:51:45 +02:00
2016-12-11 21:05:18 +01:00
# Global plugin parameters
[ -f ./params ] && for p in $(cat ./params); do
var=$p
value="$(cat ${p}.value)"
zaf_trc "Global $p parameter $var=$value"
eval export $var="$value"
done
2016-04-01 15:51:45 +02:00
export ZAF_LIB_DIR
export ZAF_TMP_DIR
export ZAF_CACHE_DIR
2016-04-01 15:51:45 +02:00
export ZAF_PLUGINS_DIR
2016-04-21 15:29:48 +02:00
export ZAF_DEBUG
unset ZAF_LOG_STDERR
export PATH
2016-04-21 15:29:48 +02:00
2016-12-11 21:05:18 +01:00
# Plugin specific functions if exists
[ -f ./functions.sh ] && . ./functions.sh
2016-04-21 15:29:48 +02:00
if [ "$(basename $0)" = "preload.sh" ] && [ -n "$*" ]; then
tmpf=$(zaf_tmpfile preload)
2016-12-11 13:06:05 +01:00
export tmpf
2016-04-21 15:29:48 +02:00
$@ 2>$tmpf
[ -s $tmpf ] && zaf_wrn <$tmpf
2016-12-11 13:06:05 +01:00
else
tmpf=$(zaf_tmpfile preload)
export tmpf
2016-04-21 15:29:48 +02:00
fi
2016-04-01 12:20:23 +02:00