mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
bbfdm: optimize uci handling
This commit is contained in:
parent
084cb9742a
commit
a828671570
3 changed files with 34 additions and 28 deletions
|
|
@ -5,13 +5,13 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bbfdm
|
||||
PKG_VERSION:=1.4.12
|
||||
PKG_VERSION:=1.4.13
|
||||
|
||||
USE_LOCAL:=0
|
||||
ifneq ($(USE_LOCAL),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
||||
PKG_SOURCE_VERSION:=e9c216f497afaf72bece8ee5e3aeae4aefc75e15
|
||||
PKG_SOURCE_VERSION:=1f9a6b0e06a0a6bfa5527275aa8c2540ed8a0463
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
|
@ -132,7 +132,6 @@ CMAKE_OPTIONS += \
|
|||
CMAKE_OPTIONS += \
|
||||
-DBBF_VENDOR_LIST:String="$(CONFIG_BBF_VENDOR_LIST)" \
|
||||
-DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \
|
||||
-DDAEMON_JSON_INPUT:String="/etc/bbfdm/input.json" \
|
||||
-DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES)
|
||||
|
||||
endif ##CONFIG_BBF_VENDOR_EXTENSION
|
||||
|
|
@ -197,7 +196,7 @@ define Package/bbfdmd/install
|
|||
$(INSTALL_DIR) $(1)/etc/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/ubus/bbfdmd $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/json/input.json $(1)/etc/bbfdm/
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/input.json $(1)/etc/bbfdm/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd
|
||||
$(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm
|
||||
$(INSTALL_BIN) ./files/etc/bbfdm/bbfdm_services.sh $(1)/etc/bbfdm/
|
||||
|
|
|
|||
28
bbfdm/files/etc/bbfdm/input.json
Normal file
28
bbfdm/files/etc/bbfdm/input.json
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"daemon": {
|
||||
"config": {
|
||||
},
|
||||
"input": {
|
||||
"type": "DotSo",
|
||||
"name": "/lib/libbbfdm.so",
|
||||
"plugin_dir": "/etc/bbfdm/plugins"
|
||||
},
|
||||
"output": {
|
||||
"type": "UBUS",
|
||||
"name": "bbfdm"
|
||||
}
|
||||
},
|
||||
"cli": {
|
||||
"config": {
|
||||
"proto": "both",
|
||||
"instance_mode": 0
|
||||
},
|
||||
"input": {
|
||||
"type": "UBUS",
|
||||
"name": "bbfdm"
|
||||
},
|
||||
"output": {
|
||||
"type": "CLI"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ USE_PROCD=1
|
|||
PROG=/usr/sbin/bbfdmd
|
||||
|
||||
BBFDM_JSON_INPUT="/etc/bbfdm/input.json"
|
||||
BBFDM_TEMP_JSON="/tmp/bbfdm.json"
|
||||
BBFDM_TEMP_JSON="/tmp/bbfdm/input.json"
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t bbfdmd.init -p info
|
||||
|
|
@ -38,31 +38,9 @@ configure_bbfdmd()
|
|||
}
|
||||
|
||||
[ "${enabled}" -eq 0 ] && return 0
|
||||
[ ! -f "${BBFDM_JSON_INPUT}" ] && return 0
|
||||
|
||||
jlog="$(jq '.daemon.config.loglevel' ${BBFDM_JSON_INPUT})"
|
||||
if [ "\"${loglevel}\"" != "${jlog}" ]; then
|
||||
update=1
|
||||
fi
|
||||
|
||||
jrefresh="$(jq '.daemon.config.refresh_time' ${BBFDM_JSON_INPUT})"
|
||||
if [ "\"${refresh_time}\"" != "${jrefresh}" ]; then
|
||||
update=1
|
||||
fi
|
||||
|
||||
jtimeout="$(jq '.daemon.config.transaction_timeout' ${BBFDM_JSON_INPUT})"
|
||||
if [ "\"${transaction_timeout}\"" != "${jtimeout}" ]; then
|
||||
update=1
|
||||
fi
|
||||
|
||||
jlevel="$(jq '.daemon.config.subprocess_level' ${BBFDM_JSON_INPUT})"
|
||||
if [ "\"${subprocess_level}\"" != "${jlevel}" ]; then
|
||||
update=1
|
||||
fi
|
||||
|
||||
if [ "${update}" -eq "1" ]; then
|
||||
if [ -f "${BBFDM_JSON_INPUT}" ]; then
|
||||
echo "$(jq --arg log ${loglevel} --arg tran ${transaction_timeout} --arg refresh ${refresh_time} --arg level ${subprocess_level} '.daemon.config += {"loglevel": $log, "refresh_time": $refresh, "transaction_timeout": $tran, "subprocess_level": $level}' ${BBFDM_JSON_INPUT})" > ${BBFDM_TEMP_JSON}
|
||||
mv ${BBFDM_TEMP_JSON} ${BBFDM_JSON_INPUT}
|
||||
fi
|
||||
|
||||
procd_set_param command ${PROG}
|
||||
|
|
@ -78,6 +56,7 @@ configure_bbfdmd()
|
|||
|
||||
start_service()
|
||||
{
|
||||
mkdir -p /tmp/bbfdm
|
||||
procd_open_instance "bbfdm"
|
||||
configure_bbfdmd
|
||||
procd_set_param respawn
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue