simple-adblock: service_triggers improvements
Signed-off-by: Stan Grishin <stangri@melmac.ca>
This commit is contained in:
parent
ad515e37fd
commit
188d332840
2 changed files with 18 additions and 5 deletions
|
@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=simple-adblock
|
PKG_NAME:=simple-adblock
|
||||||
PKG_VERSION:=1.9.2
|
PKG_VERSION:=1.9.2
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
|
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
|
||||||
PKG_LICENSE:=GPL-3.0-or-later
|
PKG_LICENSE:=GPL-3.0-or-later
|
||||||
|
|
||||||
|
|
|
@ -1318,10 +1318,22 @@ start_service() {
|
||||||
stop_service() { load_validate_config 'config' adb_stop "'$*'"; }
|
stop_service() { load_validate_config 'config' adb_stop "'$*'"; }
|
||||||
status_service() { load_validate_config 'config' adb_status "''"; }
|
status_service() { load_validate_config 'config' adb_status "''"; }
|
||||||
service_triggers() {
|
service_triggers() {
|
||||||
procd_open_trigger
|
local wan wan6 i
|
||||||
procd_add_config_trigger 'config.change' "${packageName}" /etc/init.d/${packageName} reload
|
local wan6_trigger
|
||||||
procd_add_interface_trigger 'interface.*.up' 'wan' /etc/init.d/${packageName} reload
|
config_load "$packageName"
|
||||||
procd_close_trigger
|
config_get_bool wan6_trigger 'config' 'wan6_trigger' '0'
|
||||||
|
. /lib/functions/network.sh
|
||||||
|
network_flush_cache
|
||||||
|
network_find_wan wan
|
||||||
|
wan="${wan:-wan}"
|
||||||
|
if [ "$wan6_trigger" -ne 0 ]; then
|
||||||
|
network_find_wan6 wan6
|
||||||
|
wan6="${wan6:-wan6}"
|
||||||
|
fi
|
||||||
|
for i in "$wan" "$wan6"; do
|
||||||
|
[ -n "$i" ] && procd_add_interface_trigger "interface.*" "$i" "/etc/init.d/${packageName}" start
|
||||||
|
done
|
||||||
|
procd_add_config_trigger "config.change" "$packageName" "/etc/init.d/${packageName}" reload
|
||||||
}
|
}
|
||||||
allow() { load_validate_config 'config' adb_allow "'$*'"; }
|
allow() { load_validate_config 'config' adb_allow "'$*'"; }
|
||||||
check() { load_validate_config 'config' adb_check "'$*'"; }
|
check() { load_validate_config 'config' adb_check "'$*'"; }
|
||||||
|
@ -1392,6 +1404,7 @@ load_validate_config() {
|
||||||
'download_timeout:range(1,40):20' \
|
'download_timeout:range(1,40):20' \
|
||||||
'curl_retry:range(1,5):3' \
|
'curl_retry:range(1,5):3' \
|
||||||
'verbosity:range(0,2):2' \
|
'verbosity:range(0,2):2' \
|
||||||
|
'wan6_trigger:bool:0' \
|
||||||
'led:or("", "none", file, device, string)' \
|
'led:or("", "none", file, device, string)' \
|
||||||
'dns:or("dnsmasq.addnhosts", "dnsmasq.conf", "dnsmasq.ipset", "dnsmasq.servers", "unbound.adb_list"):dnsmasq.servers' \
|
'dns:or("dnsmasq.addnhosts", "dnsmasq.conf", "dnsmasq.ipset", "dnsmasq.servers", "unbound.adb_list"):dnsmasq.servers' \
|
||||||
'dns_instance:or(list(integer, string)):0' \
|
'dns_instance:or(list(integer, string)):0' \
|
||||||
|
|
Loading…
Reference in a new issue