Merge pull request #11803 from stangri/18.06-simple-adblock
[18.06] simple-adblock: bugfixes: remove escape chars from log, restore from cache on boot
This commit is contained in:
commit
21f7d16a19
3 changed files with 29 additions and 14 deletions
|
@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=simple-adblock
|
PKG_NAME:=simple-adblock
|
||||||
PKG_VERSION:=1.8.3
|
PKG_VERSION:=1.8.3
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
|
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
|
||||||
PKG_LICENSE:=GPL-3.0-or-later
|
PKG_LICENSE:=GPL-3.0-or-later
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,10 @@ config simple-adblock 'config'
|
||||||
# blocklist too big for most routers
|
# blocklist too big for most routers
|
||||||
# list blacklist_hosts_url 'http://sysctl.org/cameleon/hosts'
|
# list blacklist_hosts_url 'http://sysctl.org/cameleon/hosts'
|
||||||
|
|
||||||
|
# File size: 1.6M
|
||||||
|
# blocklist too big for most routers
|
||||||
|
# list blacklist_hosts_url 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts'
|
||||||
|
|
||||||
# File size: 1.7M
|
# File size: 1.7M
|
||||||
# blocklist too big for most routers
|
# blocklist too big for most routers
|
||||||
# list blacklist_hosts_url 'https://hosts-file.net/ad_servers.txt'
|
# list blacklist_hosts_url 'https://hosts-file.net/ad_servers.txt'
|
||||||
|
@ -78,6 +82,9 @@ config simple-adblock 'config'
|
||||||
# blocklist too big for most routers
|
# blocklist too big for most routers
|
||||||
# list blacklist_hosts_url 'https://hostsfile.mine.nu/Hosts'
|
# list blacklist_hosts_url 'https://hostsfile.mine.nu/Hosts'
|
||||||
|
|
||||||
|
# File size: 23.0M
|
||||||
|
# blocklist too big for most routers
|
||||||
|
# list blacklist_hosts_url 'https://dbl.oisd.nl/'
|
||||||
|
|
||||||
# site was down on last check
|
# site was down on last check
|
||||||
# list blacklist_domains_url 'http://support.it-mate.co.uk/downloads/hosts.txt'
|
# list blacklist_domains_url 'http://support.it-mate.co.uk/downloads/hosts.txt'
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright 2017-2019 Stan Grishin (stangri@melmac.net)
|
# Copyright 2017-2020 Stan Grishin (stangri@melmac.net)
|
||||||
# shellcheck disable=SC2039
|
# shellcheck disable=SC2039,SC1091
|
||||||
# shellcheck disable=SC1091
|
|
||||||
PKG_VERSION='dev-test'
|
PKG_VERSION='dev-test'
|
||||||
|
|
||||||
export START=94
|
export START=94
|
||||||
|
@ -124,7 +123,7 @@ unbound_restart() { /etc/init.d/unbound restart >/dev/null 2>&1; }
|
||||||
output() {
|
output() {
|
||||||
# Can take a single parameter (text) to be output at any verbosity
|
# Can take a single parameter (text) to be output at any verbosity
|
||||||
# Or target verbosity level and text to be output at specifc verbosity
|
# Or target verbosity level and text to be output at specifc verbosity
|
||||||
local msg memmsg
|
local msg memmsg logmsg
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 1 ]; then
|
||||||
if [ $((verbosity & $1)) -gt 0 ] || [ "$verbosity" = "$1" ]; then shift; else return 0; fi
|
if [ $((verbosity & $1)) -gt 0 ] || [ "$verbosity" = "$1" ]; then shift; else return 0; fi
|
||||||
fi
|
fi
|
||||||
|
@ -132,7 +131,8 @@ output() {
|
||||||
msg="${1//$serviceName /service }";
|
msg="${1//$serviceName /service }";
|
||||||
if [ "$(printf "%b" "$msg" | wc -l)" -gt 0 ]; then
|
if [ "$(printf "%b" "$msg" | wc -l)" -gt 0 ]; then
|
||||||
[ -s "$sharedMemoryOutput" ] && memmsg="$(cat "$sharedMemoryOutput")"
|
[ -s "$sharedMemoryOutput" ] && memmsg="$(cat "$sharedMemoryOutput")"
|
||||||
logger -t "${packageName:-service} [$$]" "$(printf "%b" "${memmsg}${msg}")"
|
logmsg="$(printf "%b" "${memmsg}${msg}" | sed 's/\x1b\[[0-9;]*m//g')"
|
||||||
|
logger -t "${packageName:-service} [$$]" "$(printf "%b" "$logmsg")"
|
||||||
rm -f "$sharedMemoryOutput"
|
rm -f "$sharedMemoryOutput"
|
||||||
else
|
else
|
||||||
printf "%b" "$msg" >> "$sharedMemoryOutput"
|
printf "%b" "$msg" >> "$sharedMemoryOutput"
|
||||||
|
@ -449,7 +449,9 @@ tmpfs() {
|
||||||
triggers)
|
triggers)
|
||||||
curReload="$parallelDL $debug $dlTimeout $whitelist_domains $blacklist_domains $whitelist_domains_urls $blacklist_domains_urls $blacklist_hosts_urls $targetDNS"
|
curReload="$parallelDL $debug $dlTimeout $whitelist_domains $blacklist_domains $whitelist_domains_urls $blacklist_domains_urls $blacklist_hosts_urls $targetDNS"
|
||||||
curRestart="$compressedCache $forceDNS $led"
|
curRestart="$compressedCache $forceDNS $led"
|
||||||
if [ "$curReload" != "$readReload" ]; then
|
if [ ! -s "$jsonFile" ]; then
|
||||||
|
ret='on_boot'
|
||||||
|
elif [ "$curReload" != "$readReload" ]; then
|
||||||
ret='download'
|
ret='download'
|
||||||
elif [ "$curRestart" != "$readRestart" ]; then
|
elif [ "$curRestart" != "$readRestart" ]; then
|
||||||
ret='restart'
|
ret='restart'
|
||||||
|
@ -899,7 +901,7 @@ boot() {
|
||||||
if create_lock; then
|
if create_lock; then
|
||||||
sleep "$bootDelay"
|
sleep "$bootDelay"
|
||||||
remove_lock
|
remove_lock
|
||||||
rc_procd start_service && rc_procd service_triggers
|
rc_procd start_service 'on_boot' && rc_procd service_triggers
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,12 +919,18 @@ start_service() {
|
||||||
stats="$(tmpfs get stats)"
|
stats="$(tmpfs get stats)"
|
||||||
action="$(tmpfs get triggers)"
|
action="$(tmpfs get triggers)"
|
||||||
|
|
||||||
if [ "$action" = 'download' ] || [ "$1" = 'download' ] || [ -n "$error" ]; then
|
if [ "$action" = 'on_boot' ] || [ "$1" = 'on_boot' ]; then
|
||||||
|
if cacheOps 'testGzip' || cacheOps 'test'; then
|
||||||
|
action='restore'
|
||||||
|
fi
|
||||||
|
elif [ "$action" = 'download' ] || [ "$1" = 'download' ] || [ -n "$error" ]; then
|
||||||
action='download'
|
action='download'
|
||||||
elif [ ! -s "$outputFile" ] && ! cacheOps 'test' && ! cacheOps 'testGzip'; then
|
elif [ ! -s "$outputFile" ]; then
|
||||||
action='download'
|
if cacheOps 'testGzip' || cacheOps 'test'; then
|
||||||
elif [ ! -s "$outputFile" ] && cacheOps 'testGzip' || cacheOps 'test'; then
|
action='restore'
|
||||||
action='restore'
|
else
|
||||||
|
action='download'
|
||||||
|
fi
|
||||||
elif [ "$action" = 'restart' ] || [ "$1" = 'restart' ]; then
|
elif [ "$action" = 'restart' ] || [ "$1" = 'restart' ]; then
|
||||||
action='restart'
|
action='restart'
|
||||||
elif [ -s "$outputFile" ] && [ "$status" = "statusSuccess" ] && [ -z "$error" ]; then
|
elif [ -s "$outputFile" ] && [ "$status" = "statusSuccess" ] && [ -z "$error" ]; then
|
||||||
|
|
Loading…
Reference in a new issue