adblock: update 3.8.4
authorDirk Brenken <dev@brenken.org>
Thu, 29 Aug 2019 12:45:01 +0000 (14:45 +0200)
committerDirk Brenken <dev@brenken.org>
Thu, 29 Aug 2019 12:45:01 +0000 (14:45 +0200)
* fix the 'adb_sysver' output
* pass the adblock version information to the helper scripts correctly

Signed-off-by: Dirk Brenken <dev@brenken.org>
net/adblock/Makefile
net/adblock/files/adblock.mail
net/adblock/files/adblock.service
net/adblock/files/adblock.sh

index 3e70786d5cb8860c86f4ad7200a10ffa4dce3c2b..de2a4cd3c26523afbbb8f8e4bc0dd7b07ff8267f 100644 (file)
@@ -6,7 +6,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock
-PKG_VERSION:=3.8.3
+PKG_VERSION:=3.8.4
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0+
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
index 3b4d69cb6c2e33a0b4c693a0b21c395b5ba406d2..06f79ebf65a54e180f780fdb9eb4877ceaf35a94 100755 (executable)
@@ -14,13 +14,13 @@ PATH="/usr/sbin:/usr/bin:/sbin:/bin"
 if [ -r "/lib/functions.sh" ]
 then
        . "/lib/functions.sh"
-       adb_basever="$(uci_get adblock global adb_basever)"
        adb_debug="$(uci_get adblock extra adb_debug "0")"
        adb_msender="$(uci_get adblock extra adb_msender "no-reply@adblock")"
        adb_mreceiver="$(uci_get adblock extra adb_mreceiver)"
        adb_mtopic="$(uci_get adblock extra adb_mtopic "adblock notification")"
        adb_mprofile="$(uci_get adblock extra adb_mprofile "adb_notify")"
 fi
+adb_ver="${1}"
 adb_mail="$(command -v msmtp)"
 adb_rc=1
 
@@ -33,7 +33,7 @@ fi
 #
 if [ -z "${adb_mreceiver}" ]
 then
-       logger -p "err" -t "adblock-${adb_basever}  [${$}]" "please set the mail receiver with the 'adb_mreceiver' option"
+       logger -p "err" -t "adblock-${adb_ver}[${$}]" "please set the mail receiver with the 'adb_mreceiver' option"
        exit ${adb_rc}
 fi
 adb_mhead="From: ${adb_msender}\\nTo: ${adb_mreceiver}\\nSubject: ${adb_mtopic}\\nReply-to: ${adb_msender}\\nMime-Version: 1.0\\nContent-Type: text/html\\nContent-Disposition: inline\\n\\n"
@@ -63,9 +63,9 @@ if [ -x "${adb_mail}" ]
 then
        printf "%b" "${adb_mhead}${adb_mtext}" 2>/dev/null | "${adb_mail}" ${debug} -a "${adb_mprofile}" "${adb_mreceiver}" >/dev/null 2>&1
        adb_rc=${?}
-       logger -p "info" -t "adblock-${adb_basever}  [${$}]" "mail sent to '${adb_mreceiver}' with rc '${adb_rc}'"
+       logger -p "info" -t "adblock-${adb_ver}[${$}]" "mail sent to '${adb_mreceiver}' with rc '${adb_rc}'"
 else
-       logger -p "err" -t "adblock-${adb_basever}  [${$}]" "msmtp mail daemon not found"
+       logger -p "err" -t "adblock-${adb_ver}[${$}]" "msmtp mail daemon not found"
 fi
 
 exit ${adb_rc}
index f48d1cf2c27de2eb84247970bc81359029d8a52b..c6ac40a0461f0d9d0b41e76ff7517b3b01fac2d8 100755 (executable)
@@ -12,16 +12,16 @@ PATH="/usr/sbin:/usr/bin:/sbin:/bin"
 if [ -r "/lib/functions.sh" ]
 then
        . "/lib/functions.sh"
-       adb_basever="$(uci_get adblock global adb_basever)"
        adb_dns="$(uci_get adblock global adb_dns)"
 fi
+adb_ver="${1}"
 adb_ubus="$(command -v ubus)"
 
 if [ -x "${adb_ubus}" ] && [ -n "${adb_dns}" ]
 then
-       logger -p "info" -t "adblock-${adb_basever}  [${$}]" "ubus/adblock service started"
+       logger -p "info" -t "adblock-${adb_ver}[${$}]" "ubus/adblock service started"
        "${adb_ubus}" -S -M r -m invoke monitor | \
                { grep -qE "\"method\":\"(set|signal)\",\"data\":\{\"name\":\"${adb_dns}\""; [ $? -eq 0 ] && /etc/init.d/adblock start; }
 else
-       logger -p "err" -t "adblock-${adb_basever}  [${$}]" "can't start ubus/adblock service"
+       logger -p "err" -t "adblock-${adb_ver}[${$}]" "can't start ubus/adblock service"
 fi
index 2d321f14cc95d7a64dbb6721e983806cc6bc3fcb..0e7242e09b983c7b60d1054f5bfacbf77b2ef6a9 100755 (executable)
@@ -13,7 +13,7 @@
 #
 LC_ALL=C
 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-adb_ver="3.8.3"
+adb_ver="3.8.4"
 adb_basever=""
 adb_enabled=0
 adb_debug=0
@@ -56,7 +56,8 @@ f_load()
 
        # get system information
        #
-       adb_sysver="$(ubus -S call system board 2>/dev/null | jsonfilter -e '@.model' -e '@.release.description' | awk '{ORS="\n";printf"%s, ",$0}')"
+       adb_sysver="$(ubus -S call system board 2>/dev/null | jsonfilter -e '@.model' -e '@.release.description' | \
+               awk 'BEGIN{ORS=", "}{print $0}' | awk '{print substr($0,1,length($0)-2)}')"
 
        # parse 'global' and 'extra' section by callback
        #
@@ -865,7 +866,7 @@ f_jsnup()
        if [ "${adb_mail}" -eq 1 ] && [ -x "${adb_mailservice}" ] && \
                { [ "${status}" = "error" ] || { [ "${status}" = "enabled" ] && [ "${adb_cnt}" -le "${adb_mcnt}" ]; } }
        then
-               ("${adb_mailservice}" >/dev/null 2>&1)&
+               ("${adb_mailservice}" "${adb_ver}" >/dev/null 2>&1)&
                bg_pid="${!}"
        fi
        f_log "debug" "f_jsnup  ::: status: ${status:-"-"}, cnt: ${adb_cnt}, mail: ${adb_mail}, mail_service: ${adb_mailservice}, mail_cnt: ${adb_mcnt}, mail_pid: ${bg_pid:-"-"}"
@@ -900,7 +901,7 @@ f_bgserv()
        if [ -z "${bg_pid}" ] && [ "${status}" = "start" ] \
                && [ -x "${adb_ubusservice}" ] && [ "${adb_dnsfilereset}" = "true" ]
        then
-               ( "${adb_ubusservice}" &)
+               ( "${adb_ubusservice}" "${adb_ver}" &)
        elif [ -n "${bg_pid}" ] && [ "${status}" = "stop" ] 
        then
                kill -HUP "${bg_pid}" 2>/dev/null