bbfdm: 1.4.11

This commit is contained in:
Vivek Kumar Dutta 2023-11-21 19:19:19 +05:30
parent 3b3d7150bd
commit 71bbb8281c
No known key found for this signature in database
GPG key ID: 65C818099F37097D
4 changed files with 40 additions and 4 deletions

View file

@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bbfdm
PKG_VERSION:=1.4.10
PKG_VERSION:=1.4.11
USE_LOCAL:=0
ifneq ($(USE_LOCAL),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
PKG_SOURCE_VERSION:=7ecae3f6d146dc65d6a7362da1e28ee9de064860
PKG_SOURCE_VERSION:=2358c7ce39d4770c77ca78f3a152adf0522d7387
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View file

@ -15,3 +15,33 @@ bbfdm_add_service()
ubus call service add "{'name':'bbfdm.services','instances':{'$name':{'command':['$BBFDMD','-m','$path']}}}"
}
bbfdm_stop_service()
{
local name
name="${1}"
if [ -z "${name}" ]; then
return 0;
fi
if ubus call service list '{"name":"bbfdm.services"}' |grep -q "bbfdm.$name"; then
ubus call service delete "{'name':'bbfdm.services','instance':'bbfdm.$name'}"
fi
}
usages()
{
echo "Usages $0: <OPTIONS>..."
echo
echo " -h show help"
echo " -k micro-service name to stop"
echo
}
while getopts "s:k:h" opts; do
case "$opts" in
h) usages; exit 0;;
k) bbfdm_stop_service "${OPTARG}";;
esac
done

View file

@ -4,4 +4,5 @@ config bbfdmd 'bbfdmd'
option loglevel '1'
option refresh_time '10'
option transaction_timeout '30'
option subprocess_level '2'

View file

@ -28,7 +28,7 @@ validate_bbfdm_bbfdmd_section()
configure_bbfdmd()
{
local enabled debug sock update
local jlog jrefresh jtimeout
local jlog jrefresh jtimeout jlevel
update=0
config_load bbfdm
@ -55,8 +55,13 @@ configure_bbfdmd()
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
echo "$(jq --arg log ${loglevel} --arg tran ${transaction_timeout} --arg refresh ${refresh_time} '.daemon.config += {"loglevel": $log, "refresh_time": $refresh, "transaction_timeout": $tran}' ${BBFDM_JSON_INPUT})" > ${BBFDM_TEMP_JSON}
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