diff --git a/net/adblock/Makefile b/net/adblock/Makefile index 3e70786d5..de2a4cd3c 100644 --- a/net/adblock/Makefile +++ b/net/adblock/Makefile @@ -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 diff --git a/net/adblock/files/adblock.mail b/net/adblock/files/adblock.mail index 3b4d69cb6..06f79ebf6 100755 --- a/net/adblock/files/adblock.mail +++ b/net/adblock/files/adblock.mail @@ -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} diff --git a/net/adblock/files/adblock.service b/net/adblock/files/adblock.service index f48d1cf2c..c6ac40a04 100755 --- a/net/adblock/files/adblock.service +++ b/net/adblock/files/adblock.service @@ -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 diff --git a/net/adblock/files/adblock.sh b/net/adblock/files/adblock.sh index 2d321f14c..0e7242e09 100755 --- a/net/adblock/files/adblock.sh +++ b/net/adblock/files/adblock.sh @@ -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