adblock-fast: prepare migration to APK 23720/head
authorStan Grishin <stangri@melmac.ca>
Sat, 23 Mar 2024 01:02:05 +0000 (01:02 +0000)
committerStan Grishin <stangri@melmac.ca>
Sat, 23 Mar 2024 01:10:27 +0000 (01:10 +0000)
Signed-off-by: Stan Grishin <stangri@melmac.ca>
(cherry picked from commit 706592edccd0fb562f9d1966c6a360e9dc099fb1)

net/adblock-fast/Makefile
net/adblock-fast/files/etc/init.d/adblock-fast

index 798b36f663513ec1b597874cd85663a43bdffe2d..965639cee135ef4d91ddfaa41344d71acfd755f7 100644 (file)
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock-fast
 PKG_VERSION:=1.1.1
-PKG_RELEASE:=5
+PKG_RELEASE:=r7
 PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
 PKG_LICENSE:=GPL-3.0-or-later
 
index ee0d654ff663ea0efee49f67901820d8b65dac79..61fc43a8d5f692d9d895f5569e8f7a8583ae1c30 100755 (executable)
@@ -56,6 +56,7 @@ readonly unboundFilter='s|^|local-zone: "|;s|$|" static|'
 readonly A_TMP="/var/${packageName}.a.tmp"
 readonly B_TMP="/var/${packageName}.b.tmp"
 readonly SED_TMP="/var/${packageName}.sed.tmp"
+readonly uciConfigFile="/etc/config/${packageName}"
 readonly runningConfigFile="/dev/shm/${packageName}.config"
 readonly runningErrorFile="/dev/shm/${packageName}.error"
 readonly runningStatusFile="/dev/shm/${packageName}.status"
@@ -128,7 +129,7 @@ config_cache() {
        local i ret
        case "$param" in
                create|set)
-                       cp -f "/etc/config/${packageName}" "$runningConfigFile"
+                       cp -f "$uciConfigFile" "$runningConfigFile"
                ;;
                get)
                        case "$var" in
@@ -145,6 +146,8 @@ config_cache() {
                                local old_allowed_url old_blocked_url
                                if [ ! -s "$runningConfigFile" ]; then
                                        ret='on_boot'
+                               elif cmp -s "$uciConfigFile" "$runningConfigFile"; then
+                                       ret='restart'
                                else
                                        for i in $_reload; do
                                                local val_current val_old UCI_CONFIG_DIR
@@ -199,7 +202,7 @@ config_cache() {
        ;;
        esac
 }
-debug() { local i j; for i in "$@"; do eval "j=\$$i"; echo "${i}: ${j} "; done; }
+debug() { local __i __j; for __i in "$@"; do eval "__j=\$$__i"; echo "${__i}: ${__j} "; done; }
 dns_set_output_values() {
        case "$1" in
                dnsmasq.addnhosts)
@@ -315,7 +318,6 @@ is_running() {
        fi
 }
 ipset() { "$ipset" "$@" >/dev/null 2>&1; }
-get_version() { grep -m1 -A2 -w "^Package: $1$" /usr/lib/opkg/status | sed -n 's/Version: //p'; }
 get_ram_free() { ubus call system info | jsonfilter -e '@.memory.free'; }
 get_ram_total() { ubus call system info | jsonfilter -e '@.memory.total'; }
 led_on(){ if [ -n "${1}" ] && [ -e "${1}/trigger" ]; then echo 'default-on' > "${1}/trigger" 2>&1; fi; }
@@ -807,11 +809,8 @@ load_environment() {
                dl_flag="-O"
        fi
        led="${led:+/sys/class/leds/$led}"
-       if curl --version 2>/dev/null | grep -q "https" \
-               || wget --version 2>/dev/null | grep -q "+https" \
-               || grep -q "libustream-mbedtls" /usr/lib/opkg/status \
-               || grep -q "libustream-openssl" /usr/lib/opkg/status \
-               || grep -q "libustream-wolfssl" /usr/lib/opkg/status; then
+       if curl --version 2>/dev/null | grep -q "Protocols: .*https.*" \
+               || wget --version 2>/dev/null | grep -q "+ssl"; then
                isSSLSupported=1
        else
                unset isSSLSupported