simple-adblock: update to 1.8.8-1 16900/head
authorStan Grishin <stangri@melmac.net>
Fri, 15 Oct 2021 21:25:08 +0000 (21:25 +0000)
committerStan Grishin <stangri@melmac.net>
Fri, 15 Oct 2021 21:52:29 +0000 (21:52 +0000)
* update 'check' function

Signed-off-by: Stan Grishin <stangri@melmac.net>
(cherry picked from commit d11f310230497ea81cf207f9214528bd9d221eee)

net/simple-adblock/Makefile
net/simple-adblock/files/simple-adblock.init

index 0838e5a75ff0f1df6ab6aaf281f76eae74f3a2f8..18f02cd90d48b6c3c1a68335f6987c3c72b3f602 100644 (file)
@@ -5,8 +5,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=simple-adblock
-PKG_VERSION:=1.8.4
-PKG_RELEASE:=10
+PKG_VERSION:=1.8.8
+PKG_RELEASE:=1
 PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
 PKG_LICENSE:=GPL-3.0-or-later
 
index d96a7ae4b2d926a0c428d7ac8b835cf11f134e50..961cd0f0af3a4a844f55f87810d186d918d7ef72 100644 (file)
@@ -1117,32 +1117,37 @@ service_triggers() {
 
 check() {
        load_package_config
-       local c string="$1" 
+       local c string="$1"
        c="$(grep -c "$string" "$outputFile")"
+       c="${c:-0}"
        if [ ! -s "$outputFile" ]; then
                echo "No block-list ('$outputFile') found."
        elif [ -z "$string" ]; then
                echo "Usage: /etc/init.d/${packageName} check string"
        elif [ "$c" -gt 0 ]; then
-               if [ "$c" -gt 1 ]; then
+               if [ "$c" -eq 1 ]; then
+                       echo "Found 1 match for '$string' in '$outputFile':"
+               elif [ "$c" -le 20 ]; then
                        echo "Found $c matches for '$string' in '$outputFile':"
                else
-                       echo "Found 1 match for '$string' in '$outputFile':"
+                       echo "Found $c matches for '$string' in '$outputFile'."
+               fi
+               if [ "$c" -le 20 ]; then
+                       case "$targetDNS" in
+                               dnsmasq.addnhosts)
+                                       grep "$string" "$outputFile" | sed 's|^127.0.0.1 ||;s|^:: ||;';;
+                               dnsmasq.conf)
+                                       grep "$string" "$outputFile" | sed 's|local=/||;s|/$||;';;
+                               dnsmasq.ipset)
+                                       grep "$string" "$outputFile" | sed 's|ipset=/||;s|/adb$||;';;
+                               dnsmasq.servers)
+                                       grep "$string" "$outputFile" | sed 's|server=/||;s|/$||;';;
+                               unbound.adb_list)
+                                       grep "$string" "$outputFile" | sed 's|^local-zone: "||;s|" static$||;';;
+                       esac
                fi
-               case "$targetDNS" in
-                       dnsmasq.addnhosts)
-                               grep "$string" "$outputFile" | sed 's|^127.0.0.1 ||;s|^:: ||;';;
-                       dnsmasq.conf)
-                               grep "$string" "$outputFile" | sed 's|local=/||;s|/$||;';;
-                       dnsmasq.ipset)
-                               grep "$string" "$outputFile" | sed 's|ipset=/||;s|/adb$||;';;
-                       dnsmasq.servers)
-                               grep "$string" "$outputFile" | sed 's|server=/||;s|/$||;';;
-                       unbound.adb_list)
-                               grep "$string" "$outputFile" | sed 's|^local-zone: "||;s|" static$||;';;
-               esac
        else
-               echo "The $string is not found in current block-list ('$outputFile')."
+               echo "The '$string' is not found in current block-list ('$outputFile')."
        fi
 }