banip: update 0.3.10 10550/head
authorDirk Brenken <dev@brenken.org>
Fri, 15 Nov 2019 11:48:40 +0000 (12:48 +0100)
committerDirk Brenken <dev@brenken.org>
Fri, 15 Nov 2019 15:19:40 +0000 (16:19 +0100)
* add missing logd dependency
* check if logd is enabled during runtime
* some more init tweaks

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

index 43a2c2ef49c71ebc2eceb817d7270e0f55d1b7d5..26a88014b9d7504aeeedc5e8f7143756e913dbc4 100644 (file)
@@ -6,7 +6,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=banip
-PKG_VERSION:=0.3.9
+PKG_VERSION:=0.3.10
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0-or-later
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
@@ -17,7 +17,7 @@ define Package/banip
        SECTION:=net
        CATEGORY:=Network
        TITLE:=Ban incoming and/or outgoing ip adresses via ipsets
-       DEPENDS:=+jshn +jsonfilter +ip +ipset +iptables +ca-bundle
+       DEPENDS:=+jshn +jsonfilter +ip +ipset +iptables +ca-bundle +logd
        PKGARCH:=all
 endef
 
index c999c6b00e9b90b366988fc6da034e5fc05ce2e6..75fbe5e92a02005b6703e1ab8c01e73abe24916f 100755 (executable)
@@ -4,18 +4,17 @@
 START=30
 USE_PROCD=1
 
-EXTRA_COMMANDS="refresh status"
-EXTRA_HELP="   refresh Refresh ipsets without new list downloads
-       status  Print runtime information"
+EXTRA_COMMANDS="refresh"
+EXTRA_HELP="   refresh Refresh ipsets without new list downloads"
 
 ban_init="/etc/init.d/banip"
 ban_script="/usr/bin/banip.sh"
 ban_pidfile="/var/run/banip.pid"
 
-if [ -s "${ban_pidfile}" ] && \
-       [ "${action}" != "help" ] && [ "${action}" != "status" ] && [ "${action}" != "boot" ] && [ "${action}" != "enabled" ]
+if [ -s "${ban_pidfile}" ] && { [ "${action}" = "start" ] || [ "${action}" = "stop" ] || \
+       [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "refresh" ]; }
 then
-       exit 1
+       exit 0
 fi
 
 boot()
index c8639a9c6787607da4e1f8627b676049c4f2a749..0a0f4d0fdf303cf93379c8530c8d258d6174f1f0 100755 (executable)
@@ -13,7 +13,7 @@
 #
 LC_ALL=C
 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-ban_ver="0.3.9"
+ban_ver="0.3.10"
 ban_basever=""
 ban_enabled=0
 ban_automatic="1"
@@ -97,6 +97,16 @@ f_envload()
        config_load banip
        config_foreach parse_config source
 
+       # log daemon check
+       #
+       if [ "$(/etc/init.d/log running; printf "%u" "${?}")" -eq 1 ]
+       then
+               unset ban_logger
+               f_log "info" "your log daemon 'logd' is not running, please enable 'logd' to use this service"
+               f_rmtemp
+               exit 1
+       fi
+
        # version check
        #
        if [ -z "${ban_basever}" ] || [ "${ban_ver%.*}" != "${ban_basever}" ]