Merge pull request #22839 from stangri/master-adblock-fast
adblock-fast: bugfixes: getsize/resolver
This commit is contained in:
commit
da85214ef6
2 changed files with 16 additions and 9 deletions
|
@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=adblock-fast
|
PKG_NAME:=adblock-fast
|
||||||
PKG_VERSION:=1.1.0
|
PKG_VERSION:=1.1.0
|
||||||
PKG_RELEASE:=3
|
PKG_RELEASE:=4
|
||||||
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
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,8 @@ get_url_filesize() {
|
||||||
[ -n "$url" ] || return 0
|
[ -n "$url" ] || return 0
|
||||||
is_present 'curl' || return 0
|
is_present 'curl' || return 0
|
||||||
size_command='curl --silent --insecure --fail --head --request GET'
|
size_command='curl --silent --insecure --fail --head --request GET'
|
||||||
size="$($size_command "$url" | grep -Po '^[cC]ontent-[lL]ength: \K\w+')"
|
# size="$($size_command "$url" | grep -Po '^[cC]ontent-[lL]ength: \K\w+')"
|
||||||
|
size="$($size_command "$url" | grep -Eo '^[cC]ontent-[lL]ength: (.*)' | awk '{print $2}')"
|
||||||
# shellcheck disable=SC3037
|
# shellcheck disable=SC3037
|
||||||
echo -en "$size"
|
echo -en "$size"
|
||||||
}
|
}
|
||||||
|
@ -346,7 +347,7 @@ uci_changes() {
|
||||||
local PACKAGE="$1"
|
local PACKAGE="$1"
|
||||||
local CONFIG="$2"
|
local CONFIG="$2"
|
||||||
local OPTION="$3"
|
local OPTION="$3"
|
||||||
if [ -s "${UCI_CONFIG_DIR:-'/etc/config'}${PACKAGE}" ]; then
|
if [ -s "${UCI_CONFIG_DIR:-/etc/config/}${PACKAGE}" ]; then
|
||||||
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} changes "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} changes "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -775,6 +776,7 @@ load_environment() {
|
||||||
resolver() {
|
resolver() {
|
||||||
_dnsmasq_instance_config() {
|
_dnsmasq_instance_config() {
|
||||||
local cfg="$1" param="$2"
|
local cfg="$1" param="$2"
|
||||||
|
[ -s "/etc/config/dhcp" ] || return 0
|
||||||
case "$param" in
|
case "$param" in
|
||||||
dnsmasq.addnhosts)
|
dnsmasq.addnhosts)
|
||||||
if [ "$(uci_get 'dhcp' "$cfg" 'serversfile')" = "$dnsmasqServersFile" ]; then
|
if [ "$(uci_get 'dhcp' "$cfg" 'serversfile')" = "$dnsmasqServersFile" ]; then
|
||||||
|
@ -797,6 +799,7 @@ resolver() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
_smartdns_instance_config() {
|
_smartdns_instance_config() {
|
||||||
|
[ -s "/etc/config/smartdns" ] || return 0
|
||||||
local cfg="$1" param="$2"
|
local cfg="$1" param="$2"
|
||||||
case "$param" in
|
case "$param" in
|
||||||
cleanup)
|
cleanup)
|
||||||
|
@ -835,12 +838,16 @@ resolver() {
|
||||||
rm -f "$smartdnsIpsetFile" "$smartdnsIpsetCache" "${compressed_cache_dir}/${smartdnsIpsetGzip}" "$smartdnsIpsetConfig"
|
rm -f "$smartdnsIpsetFile" "$smartdnsIpsetCache" "${compressed_cache_dir}/${smartdnsIpsetGzip}" "$smartdnsIpsetConfig"
|
||||||
rm -f "$smartdnsNftsetFile" "$smartdnsNftsetCache" "${compressed_cache_dir}/${smartdnsNftsetGzip}" "$smartdnsNftsetConfig"
|
rm -f "$smartdnsNftsetFile" "$smartdnsNftsetCache" "${compressed_cache_dir}/${smartdnsNftsetGzip}" "$smartdnsNftsetConfig"
|
||||||
rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
|
rm -f "$unboundFile" "$unboundCache" "$unboundGzip"
|
||||||
|
if [ -s "/etc/config/dhcp" ]; then
|
||||||
config_load 'dhcp'
|
config_load 'dhcp'
|
||||||
config_foreach _dnsmasq_instance_config 'dnsmasq' 'cleanup'
|
config_foreach _dnsmasq_instance_config 'dnsmasq' 'cleanup'
|
||||||
uci_commit 'dhcp'
|
[ -n "$(uci_changes 'dhcp')" ] && uci_commit 'dhcp'
|
||||||
|
fi
|
||||||
|
if [ -s "/etc/config/smartdns" ]; then
|
||||||
config_load 'smartdns'
|
config_load 'smartdns'
|
||||||
config_foreach _smartdns_instance_config 'smartdns' 'cleanup'
|
config_foreach _smartdns_instance_config 'smartdns' 'cleanup'
|
||||||
uci_commit 'smartdns'
|
[ -n "$(uci_changes 'smartdns')" ] && uci_commit 'smartdns'
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
on_start)
|
on_start)
|
||||||
if [ ! -s "$outputFile" ]; then
|
if [ ! -s "$outputFile" ]; then
|
||||||
|
|
Loading…
Reference in a new issue