summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2023-04-12 15:31:31 +0200
committerDirk Brenken <dev@brenken.org>2023-04-12 15:31:31 +0200
commitd178bf5d35417141a201e9ada7d04e912e4d2d7d (patch)
tree50350cb18715ce141a9c841ed385ae0926ef5839
parent0cf46d43f42969f4d7b6e881931742a40b36d1a2 (diff)
banip: update 0.8.3-2
* more init fixes Signed-off-by: Dirk Brenken <dev@brenken.org>
-rw-r--r--net/banip/Makefile2
-rw-r--r--net/banip/files/banip-functions.sh25
-rwxr-xr-xnet/banip/files/banip.init5
3 files changed, 19 insertions, 13 deletions
diff --git a/net/banip/Makefile b/net/banip/Makefile
index d2e54a2ad..eabaadb58 100644
--- a/net/banip/Makefile
+++ b/net/banip/Makefile
@@ -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>
diff --git a/net/banip/files/banip-functions.sh b/net/banip/files/banip-functions.sh
index 991d1147e..3b485e3bd 100644
--- a/net/banip/files/banip-functions.sh
+++ b/net/banip/files/banip-functions.sh
@@ -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"
diff --git a/net/banip/files/banip.init b/net/banip/files/banip.init
index 6822a1bcb..891dee4eb 100755
--- a/net/banip/files/banip.init
+++ b/net/banip/files/banip.init
@@ -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}"