Browse Source

Merge pull request #9863 from dibdot/adblock

adblock: update 3.8.4
lilik-openwrt-22.03
Dirk Brenken 5 years ago
committed by GitHub
parent
commit
4f43e9b388
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
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 include $(TOPDIR)/rules.mk
PKG_NAME:=adblock PKG_NAME:=adblock
PKG_VERSION:=3.8.3
PKG_VERSION:=3.8.4
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+ PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org> 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" ] if [ -r "/lib/functions.sh" ]
then then
. "/lib/functions.sh" . "/lib/functions.sh"
adb_basever="$(uci_get adblock global adb_basever)"
adb_debug="$(uci_get adblock extra adb_debug "0")" adb_debug="$(uci_get adblock extra adb_debug "0")"
adb_msender="$(uci_get adblock extra adb_msender "no-reply@adblock")" adb_msender="$(uci_get adblock extra adb_msender "no-reply@adblock")"
adb_mreceiver="$(uci_get adblock extra adb_mreceiver)" adb_mreceiver="$(uci_get adblock extra adb_mreceiver)"
adb_mtopic="$(uci_get adblock extra adb_mtopic "adblock notification")" adb_mtopic="$(uci_get adblock extra adb_mtopic "adblock notification")"
adb_mprofile="$(uci_get adblock extra adb_mprofile "adb_notify")" adb_mprofile="$(uci_get adblock extra adb_mprofile "adb_notify")"
fi fi
adb_ver="${1}"
adb_mail="$(command -v msmtp)" adb_mail="$(command -v msmtp)"
adb_rc=1 adb_rc=1
@ -33,7 +33,7 @@ fi
# #
if [ -z "${adb_mreceiver}" ] if [ -z "${adb_mreceiver}" ]
then 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} exit ${adb_rc}
fi 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" 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 then
printf "%b" "${adb_mhead}${adb_mtext}" 2>/dev/null | "${adb_mail}" ${debug} -a "${adb_mprofile}" "${adb_mreceiver}" >/dev/null 2>&1 printf "%b" "${adb_mhead}${adb_mtext}" 2>/dev/null | "${adb_mail}" ${debug} -a "${adb_mprofile}" "${adb_mreceiver}" >/dev/null 2>&1
adb_rc=${?} 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 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 fi
exit ${adb_rc} 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" ] if [ -r "/lib/functions.sh" ]
then then
. "/lib/functions.sh" . "/lib/functions.sh"
adb_basever="$(uci_get adblock global adb_basever)"
adb_dns="$(uci_get adblock global adb_dns)" adb_dns="$(uci_get adblock global adb_dns)"
fi fi
adb_ver="${1}"
adb_ubus="$(command -v ubus)" adb_ubus="$(command -v ubus)"
if [ -x "${adb_ubus}" ] && [ -n "${adb_dns}" ] if [ -x "${adb_ubus}" ] && [ -n "${adb_dns}" ]
then 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 | \ "${adb_ubus}" -S -M r -m invoke monitor | \
{ grep -qE "\"method\":\"(set|signal)\",\"data\":\{\"name\":\"${adb_dns}\""; [ $? -eq 0 ] && /etc/init.d/adblock start; } { grep -qE "\"method\":\"(set|signal)\",\"data\":\{\"name\":\"${adb_dns}\""; [ $? -eq 0 ] && /etc/init.d/adblock start; }
else 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 fi

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

@ -13,7 +13,7 @@
# #
LC_ALL=C LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin" PATH="/usr/sbin:/usr/bin:/sbin:/bin"
adb_ver="3.8.3"
adb_ver="3.8.4"
adb_basever="" adb_basever=""
adb_enabled=0 adb_enabled=0
adb_debug=0 adb_debug=0
@ -56,7 +56,8 @@ f_load()
# get system information # 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 # parse 'global' and 'extra' section by callback
# #
@ -865,7 +866,7 @@ f_jsnup()
if [ "${adb_mail}" -eq 1 ] && [ -x "${adb_mailservice}" ] && \ if [ "${adb_mail}" -eq 1 ] && [ -x "${adb_mailservice}" ] && \
{ [ "${status}" = "error" ] || { [ "${status}" = "enabled" ] && [ "${adb_cnt}" -le "${adb_mcnt}" ]; } } { [ "${status}" = "error" ] || { [ "${status}" = "enabled" ] && [ "${adb_cnt}" -le "${adb_mcnt}" ]; } }
then then
("${adb_mailservice}" >/dev/null 2>&1)&
("${adb_mailservice}" "${adb_ver}" >/dev/null 2>&1)&
bg_pid="${!}" bg_pid="${!}"
fi 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:-"-"}" 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" ] \ if [ -z "${bg_pid}" ] && [ "${status}" = "start" ] \
&& [ -x "${adb_ubusservice}" ] && [ "${adb_dnsfilereset}" = "true" ] && [ -x "${adb_ubusservice}" ] && [ "${adb_dnsfilereset}" = "true" ]
then then
( "${adb_ubusservice}" &)
( "${adb_ubusservice}" "${adb_ver}" &)
elif [ -n "${bg_pid}" ] && [ "${status}" = "stop" ] elif [ -n "${bg_pid}" ] && [ "${status}" = "stop" ]
then then
kill -HUP "${bg_pid}" 2>/dev/null kill -HUP "${bg_pid}" 2>/dev/null


Loading…
Cancel
Save