* preserve DNS cache after adblock processing, - 'unbound' and 'named' support this (please check readme) - 'dnsmasq' now uses the 'servers-file' directive to minimize the reload disruption, even though the dns cache will be cleared after SIGHUP - 'kresd' dns cache is persistent by upstream default, anyway Turris Omnia devices need a small upstream software change which is not accepted/implemented yet * email notification in case of an error or domain count < n (default 0, check readme) * removed securemecca from default config (service has been closed) * new separate functions for hash compare and list/overall count * add missing package dependencies * various clean-ups * update documentation Signed-off-by: Dirk Brenken <dev@brenken.org>
89 lines
1.7 KiB
Bash
Executable file
89 lines
1.7 KiB
Bash
Executable file
#!/bin/sh /etc/rc.common
|
|
#
|
|
|
|
START=30
|
|
USE_PROCD=1
|
|
|
|
EXTRA_COMMANDS="suspend resume query status"
|
|
EXTRA_HELP=" suspend Suspend adblock processing
|
|
resume Resume adblock processing
|
|
query <DOMAIN> Query active blocklists for specific domains
|
|
status Print runtime information"
|
|
|
|
adb_init="/etc/init.d/adblock"
|
|
adb_script="/usr/bin/adblock.sh"
|
|
|
|
boot()
|
|
{
|
|
adb_boot=1
|
|
rc_procd start_service
|
|
}
|
|
|
|
start_service()
|
|
{
|
|
if [ $("${adb_init}" enabled; printf "%u" ${?}) -eq 0 ]
|
|
then
|
|
if [ -n "${adb_boot}" ]
|
|
then
|
|
local trigger="$(uci_get adblock.global.adb_trigger)"
|
|
if [ "${trigger}" != "timed" ]
|
|
then
|
|
return 0
|
|
fi
|
|
fi
|
|
procd_open_instance "adblock"
|
|
procd_set_param command "${adb_script}" "${@}"
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
fi
|
|
}
|
|
|
|
reload_service()
|
|
{
|
|
rc_procd start_service reload
|
|
}
|
|
|
|
stop_service()
|
|
{
|
|
rc_procd "${adb_script}" stop
|
|
rc_procd start_service
|
|
}
|
|
|
|
restart()
|
|
{
|
|
rc_procd start_service restart
|
|
}
|
|
|
|
suspend()
|
|
{
|
|
rc_procd "${adb_script}" suspend
|
|
}
|
|
|
|
resume()
|
|
{
|
|
rc_procd "${adb_script}" resume
|
|
}
|
|
|
|
query()
|
|
{
|
|
rc_procd "${adb_script}" query "${1}"
|
|
}
|
|
|
|
status()
|
|
{
|
|
rc_procd "${adb_script}" status
|
|
}
|
|
|
|
service_triggers()
|
|
{
|
|
local trigger="$(uci_get adblock.global.adb_trigger)"
|
|
local delay="$(uci_get adblock.global.adb_triggerdelay)"
|
|
|
|
if [ "${trigger}" != "none" ] && [ "${trigger}" != "timed" ]
|
|
then
|
|
PROCD_RELOAD_DELAY=$((${delay:-1} * 1000))
|
|
procd_add_interface_trigger "interface.*.up" "${trigger}" "${adb_init}" start
|
|
fi
|
|
procd_add_reload_trigger "adblock"
|
|
}
|