* revamp LuCI GUI (see luci repo for details) * integrated runtime statistics in normal adblock ubus service instance (see readme) * simplified boot/init * no longer use raw interface trigger * use only network interface trigger, pre-configured for 'wan/wwan/lan' interfaces (see readme) * fixed a reload issue * removed switch to disable tld compression (seems to be pretty stable) * muted awk parser if source list contains incorrect records * raise dns backend timeout to 20 seconds * documentation update * cosmetics Signed-off-by: Dirk Brenken <dev@brenken.org>
73 lines
1.3 KiB
Bash
Executable file
73 lines
1.3 KiB
Bash
Executable file
#!/bin/sh /etc/rc.common
|
|
#
|
|
|
|
START=90
|
|
USE_PROCD=1
|
|
|
|
EXTRA_COMMANDS="suspend resume query"
|
|
EXTRA_HELP=" suspend Suspend adblock processing
|
|
resume Resume adblock processing
|
|
query <DOMAIN> Query active blocklists for specific domain"
|
|
|
|
adb_init="/etc/init.d/adblock"
|
|
adb_script="/usr/bin/adblock.sh"
|
|
|
|
boot()
|
|
{
|
|
local list iface="$(uci -q get adblock.global.adb_iface)"
|
|
|
|
for name in ${iface}
|
|
do
|
|
list="${list} network.interface.${name}"
|
|
done
|
|
ubus -t 60 wait_for network.interface ${list}
|
|
rc_procd start_service
|
|
}
|
|
|
|
start_service()
|
|
{
|
|
if [ $("${adb_init}" enabled; printf ${?}) -eq 0 ]
|
|
then
|
|
procd_open_instance "adblock"
|
|
procd_set_param command "${adb_script}" "${@}"
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
fi
|
|
}
|
|
|
|
stop_service()
|
|
{
|
|
rc_procd "${adb_script}" stop
|
|
}
|
|
|
|
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}"
|
|
}
|
|
|
|
service_triggers()
|
|
{
|
|
local iface="$(uci -q get adblock.global.adb_iface)"
|
|
|
|
for name in ${iface}
|
|
do
|
|
procd_add_interface_trigger "interface.*.up" "${name}" "${adb_init}" start
|
|
done
|
|
procd_add_config_trigger "config.change" "adblock" "${adb_init}" start
|
|
}
|