banip: update 0.8.3-2
authorDirk Brenken <dev@brenken.org>
Wed, 12 Apr 2023 13:31:31 +0000 (15:31 +0200)
committerDirk Brenken <dev@brenken.org>
Wed, 12 Apr 2023 13:31:31 +0000 (15:31 +0200)
* more init fixes

Signed-off-by: Dirk Brenken <dev@brenken.org>
net/banip/Makefile
net/banip/files/banip-functions.sh
net/banip/files/banip.init

index d2e54a2ad1bf2cc93caa0ad2ea79c2b9d2e4e315..eabaadb58eadb17b908ec6fd60f4236bb156fc75 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=banip
 PKG_VERSION:=0.8.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=GPL-3.0-or-later
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
 
index 991d1147e8d78ec3b696d19845f2ffa3b9140679..3b485e3bdf47c4ca6eb644136231f50f04b23d5f 100644 (file)
@@ -78,7 +78,10 @@ ban_debug="0"
 f_system() {
        local cpu core
 
-       [ -z "${ban_dev}" ] && ban_cores="$(uci_get banip global ban_cores)"
+       if [ -z "${ban_dev}" ]; then
+               ban_debug="$(uci_get banip global ban_debug)"
+               ban_cores="$(uci_get banip global ban_cores)"
+       fi
        ban_memory="$("${ban_awkcmd}" '/^MemAvailable/{printf "%s",int($2/1000)}' "/proc/meminfo" 2>/dev/null)"
        ban_ver="$(${ban_ubuscmd} -S call rpc-sys packagelist '{ "all": true }' 2>/dev/null | jsonfilter -ql1 -e '@.packages.banip')"
        ban_sysver="$(${ban_ubuscmd} -S call system board 2>/dev/null | jsonfilter -ql1 -e '@.model' -e '@.release.description' |
@@ -1282,17 +1285,21 @@ f_mail() {
        f_log "debug" "f_mail    ::: notification: ${ban_mailnotification}, template: ${ban_mailtemplate}, profile: ${ban_mailprofile}, receiver: ${ban_mailreceiver}, rc: ${?}"
 }
 
-# check banIP availability and initial sourcing
+# initial sourcing
+#
+if [ -r "/lib/functions.sh" ] && [ -r "/lib/functions/network.sh" ] && [ -r "/usr/share/libubox/jshn.sh" ]; then
+       . "/lib/functions.sh"
+       . "/lib/functions/network.sh"
+       . "/usr/share/libubox/jshn.sh"
+else
+       rm -rf "${ban_lock}"
+       exit 1
+fi
+
+# check banIP availability
 #
 f_system
 if [ "${ban_action}" != "stop" ]; then
-       if [ -r "/lib/functions.sh" ] && [ -r "/lib/functions/network.sh" ] && [ -r "/usr/share/libubox/jshn.sh" ]; then
-               . "/lib/functions.sh"
-               . "/lib/functions/network.sh"
-               . "/usr/share/libubox/jshn.sh"
-       else
-               f_log "err" "system libraries not found"
-       fi
        [ ! -d "/etc/banip" ] && f_log "err" "banIP config directory not found, please re-install the package"
        [ ! -r "/etc/banip/banip.feeds" ] && f_log "err" "banIP feed file not found, please re-install the package"
        [ ! -r "/etc/config/banip" ] && f_log "err" "banIP config not found, please re-install the package"
index 6822a1bcb26504ee57ad34b291c5b3c5e0b251da..891dee4eb0bce6a93a9bd92dc00d02b9eb906134 100755 (executable)
@@ -20,9 +20,8 @@ ban_funlib="/usr/lib/banip-functions.sh"
 ban_pidfile="/var/run/banip.pid"
 ban_lock="/var/run/banip.lock"
 
-[ "${action}" = "boot" ] && /etc/init.d/banip running && exit 0
-{ [ "${action}" = "stop" ] || [ "${action}" = "lookup" ]; } && ! /etc/init.d/banip running && exit 0
-[ ! -r "${ban_funlib}" ] && [ "${action}" != "boot" ] && exit 1
+[ "${action}" = "boot" ] && "${ban_init}" running && exit 0
+{ [ "${action}" = "stop" ] || [ "${action}" = "report" ] || [ "${action}" = "search" ] || [ "${action}" = "survey" ] || [ "${action}" = "lookup" ]; } && ! "${ban_init}" running && exit 0
 [ -d "${ban_lock}" ] && { [ "${action}" = "start" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "lookup" ]; } && exit 1
 [ ! -d "${ban_lock}" ] && { [ "${action}" = "start" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "lookup" ]; } && mkdir -p "${ban_lock}"