diff --git a/bbfdm/Makefile b/bbfdm/Makefile index 1a38634d76b28da92b667189251472ca4bc8ff22..5b8612f7f31f58f014837302e604398643c5a913 100644 --- a/bbfdm/Makefile +++ b/bbfdm/Makefile @@ -5,11 +5,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bbfdm -PKG_VERSION:=1.3.22 +PKG_VERSION:=1.3.23 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git -PKG_SOURCE_VERSION:=1af9a94e0be2df0522c469367f3fb58801d2fcc2 +PKG_SOURCE_VERSION:=2eac512589868eb68e4671f5e914a3718854c63c PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_MIRROR_HASH:=skip diff --git a/bbfdm/files/etc/init.d/bbfdmd b/bbfdm/files/etc/init.d/bbfdmd index 93a9335c5a39789b4ca3180ff9eccb0393e9d786..0b7a11d912e5e99902c1354f0c665315a6b7812e 100644 --- a/bbfdm/files/etc/init.d/bbfdmd +++ b/bbfdm/files/etc/init.d/bbfdmd @@ -17,42 +17,47 @@ validate_bbfdm_bbfdmd_section() { uci_validate_section bbfdm bbfdmd "bbfdmd" \ 'enabled:bool:true' \ - 'debug:bool:false' \ - 'loglevel:uinteger' \ 'sock:string' \ - 'refresh_time:uinteger' \ - 'transaction_timeout:uinteger' \ + 'debug:bool:false' \ + 'loglevel:uinteger:1' \ + 'refresh_time:uinteger:0' \ + 'transaction_timeout:uinteger:30' \ 'subprocess_level:uinteger' } configure_bbfdmd() { - local enabled debug sock + local enabled debug sock update + local jlog jrefresh jtimeout + update=0 config_load bbfdm - validate_bbfdm_bbfdmd_section || { log "Validation of bbfdmd section failed" return 1; } [ "${enabled}" -eq 0 ] && return 0 - [ ! -f "${BBFDM_JSON_INPUT}" ] && return 0 - if [ -n "${loglevel}" ]; then - echo "$(jq --arg res ${loglevel} '.daemon.config += {"loglevel": $res}' ${BBFDM_JSON_INPUT})" > ${BBFDM_TEMP_JSON} - cp ${BBFDM_TEMP_JSON} ${BBFDM_JSON_INPUT} + 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 - if [ -n "${refresh_time}" ]; then - echo "$(jq --arg res ${refresh_time} '.daemon.config += {"refresh_time": $res}' ${BBFDM_JSON_INPUT})" > ${BBFDM_TEMP_JSON} - cp ${BBFDM_TEMP_JSON} ${BBFDM_JSON_INPUT} + jtimeout="$(jq '.daemon.config.transaction_timeout' ${BBFDM_JSON_INPUT})" + if [ "\"${transaction_timeout}\"" != "${jtimeout}" ]; then + update=1 fi - if [ -n "${transaction_timeout}" ]; then - echo "$(jq --arg res ${transaction_timeout} '.daemon.config += {"transaction_timeout": $res}' ${BBFDM_JSON_INPUT})" > ${BBFDM_TEMP_JSON} - cp ${BBFDM_TEMP_JSON} ${BBFDM_JSON_INPUT} + 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} + mv ${BBFDM_TEMP_JSON} ${BBFDM_JSON_INPUT} fi procd_set_param command ${PROG} @@ -72,6 +77,13 @@ start_service() configure_bbfdmd procd_set_param respawn procd_close_instance "bbfdm" + + ubus call service state '{"name":"bbfdm.services", "spawn":true}' +} + +stop_service() +{ + ubus call service state '{"name":"bbfdm.services", "spawn":false}' } service_triggers()