then
if [ -n "${adb_boot}" ]
then
- local trigger="$(uci_get adblock.global.adb_trigger)"
+ local trigger="$(uci_get adblock global adb_trigger)"
if [ "${trigger}" != "timed" ]
then
return 0
status()
{
- local key keylist value rtfile="$(uci_get adblock.extra.adb_rtfile)"
+ local key keylist value rtfile="$(uci_get adblock extra adb_rtfile)"
rtfile="${rtfile:-"/tmp/adb_runtime.json"}"
if [ -s "${rtfile}" ]
service_triggers()
{
- local trigger="$(uci_get adblock.global.adb_trigger)"
- local delay="$(uci_get adblock.extra.adb_triggerdelay)"
+ local trigger="$(uci_get adblock global adb_trigger)"
+ local delay="$(uci_get adblock extra adb_triggerdelay)"
if [ "${trigger}" != "none" ] && [ "${trigger}" != "timed" ]
then
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-adb_ver="3.5.0"
+adb_ver="3.5.1"
adb_sysver="unknown"
adb_enabled=0
adb_debug=0
uci -q set resolver.kresd.keep_cache="1"
elif [ ${adb_enabled} -eq 0 ] || ([ ${adb_dnsflush} -eq 1 ] && [ "$(uci -q get resolver.kresd.keep_cache)" = "1" ])
then
- uci -q delete resolver.kresd.keep_cache
+ uci -q set resolver.kresd.keep_cache="0"
fi
;;
esac
then
f_temp
f_dnsup
- f_jsnup
+ f_jsnup "${mode}"
f_log "info" "${mode} adblock processing"
f_rmtemp
exit 0
#
f_jsnup()
{
- local bg_pid rundate status="${1}" mode="normal mode"
+ local bg_pid rundate="$(/bin/date "+%d.%m.%Y %H:%M:%S")" status="${1:-"enabled"}" mode="normal mode" no_mail=0
- if [ -z "${status}" ]
+ if [ ${adb_rc} -gt 0 ]
then
- rundate="$(/bin/date "+%d.%m.%Y %H:%M:%S")"
- if [ ${adb_rc} -gt 0 ]
- then
- status="error"
- elif [ ${adb_enabled} -eq 0 ]
- then
- status="disabled"
- elif [ -s "${adb_dnsdir}/.${adb_dnsfile}" ]
- then
- status="paused"
- else
- status="enabled"
- f_count
- fi
+ status="error"
+ fi
+ if [ ${adb_enabled} -eq 0 ]
+ then
+ status="disabled"
+ fi
+ if [ "${status}" = "suspend" ]
+ then
+ status="paused"
+ fi
+ if [ "${status}" = "resume" ]
+ then
+ no_mail=1
+ status="enabled"
+ fi
+ if [ "${status}" = "enabled" ]
+ then
+ f_count
fi
if [ ${adb_backup_mode} -eq 1 ]
then
- mode="normal/backup mode"
+ mode="backup mode"
fi
if [ -z "${adb_fetchinfo}" ] && [ -s "${adb_rtfile}" ]
json_close_object
json_dump > "${adb_rtfile}"
- if [ ${adb_notify} -eq 1 ] && [ -x /etc/adblock/adblock.notify ] && ([ "${status}" = "error" ] ||\
- ([ "${status}" = "enabled" ] && [ ${adb_cnt} -le ${adb_notifycnt} ]))
+ if [ ${adb_notify} -eq 1 ] && [ ${no_mail} -eq 0 ] && [ -x /etc/adblock/adblock.notify ] && \
+ ([ "${status}" = "error" ] || ([ "${status}" = "enabled" ] && [ ${adb_cnt} -le ${adb_notifycnt} ]))
then
(/etc/adblock/adblock.notify >/dev/null 2>&1) &
bg_pid=${!}