Browse Source

adblock: update 3.8.4

* fix the 'adb_sysver' output
* pass the adblock version information to the helper scripts correctly

Signed-off-by: Dirk Brenken <dev@brenken.org>
lilik-openwrt-22.03
Dirk Brenken 5 years ago
parent
commit
161597f2fa
No known key found for this signature in database GPG Key ID: 9D71CD547BFAE684
4 changed files with 13 additions and 12 deletions
  1. +1
    -1
      net/adblock/Makefile
  2. +4
    -4
      net/adblock/files/adblock.mail
  3. +3
    -3
      net/adblock/files/adblock.service
  4. +5
    -4
      net/adblock/files/adblock.sh

+ 1
- 1
net/adblock/Makefile View 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>


+ 4
- 4
net/adblock/files/adblock.mail View File

@ -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}

+ 3
- 3
net/adblock/files/adblock.service View File

@ -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

+ 5
- 4
net/adblock/files/adblock.sh View File

@ -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


Loading…
Cancel
Save