adblock: update 2.0.4 3726/head
authorDirk Brenken <dev@brenken.org>
Sat, 31 Dec 2016 13:17:40 +0000 (14:17 +0100)
committerDirk Brenken <dev@brenken.org>
Sat, 31 Dec 2016 13:17:40 +0000 (14:17 +0100)
* small fixes & cosmetics (missed in last commit)

Signed-off-by: Dirk Brenken <dev@brenken.org>
net/adblock/Makefile
net/adblock/files/README.md
net/adblock/files/adblock.sh

index 82636ff6add667130c164b41aefe1011febdef8c..e607437dd4f51dd828f6a831a4110e8eaca1b275 100644 (file)
@@ -6,7 +6,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock
-PKG_VERSION:=2.0.3
+PKG_VERSION:=2.0.4
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0+
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
index 569dab2fd27e482406290e70f489d9d1059c0c73..4efe3bdd827e2cef251d1fc6a3969cb50aa37053 100644 (file)
@@ -157,13 +157,31 @@ This will output the active block lists, the overall domain count and the last r
                 "data": {
                     "active_lists": [
                         {
-                            "adaway": "409",
-                            "yoyo": "2368",
-                            "disconnect": "3198"
+                            "palevo": "14",
+                            "blacklist": "143",
+                            "winspy": "164",
+                            "zeus": "446",
+                            "rolist": "644",
+                            "malwarelist": "1218",
+                            "openphish": "1515",
+                            "ransomware": "1463",
+                            "ruadlist": "1773",
+                            "yoyo": "2320",
+                            "dshield": "123",
+                            "disconnect": "3181",
+                            "spam404": "6155",
+                            "malware": "9882",
+                            "whocares": "11825",
+                            "winhelp": "10917",
+                            "sysctl": "8529",
+                            "securemecca": "9919",
+                            "shalla": "25779",
+                            "hphosts": "37111"
                         }
                     ],
-                    "blocked_domains": "5975",
-                    "last_rundate": "30.12.2016 21:03:45"
+                    "blocked_domains": "133121",
+                    "last_rundate": "31.12.2016 07:19:25",
+                    "system": "LEDE Reboot SNAPSHOT r2709-b7677f05d6"
                 }
             }
         }
index 9a8cb2828711e749176400e9931d2c84c9061053..5374c99228e58f13391ce9dbceebf06e0d09d387 100755 (executable)
@@ -10,7 +10,7 @@
 #
 LC_ALL=C
 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-adb_ver="2.0.3"
+adb_ver="2.0.4"
 adb_enabled=1
 adb_debug=0
 adb_whitelist="/etc/adblock/adblock.whitelist"
@@ -86,7 +86,7 @@ f_envcheck()
 {
     # check 'enabled' option
     #
-    if [ "${adb_enabled}" != "1" ]
+    if [ ${adb_enabled} -ne 1 ]
     then
         if [ "$(ls -dA "${adb_dnsdir}/${adb_dnsprefix}"* >/dev/null 2>&1)" ]
         then
@@ -125,10 +125,6 @@ f_envcheck()
     then
         awk "${adb_whitelist_rset}" "${adb_whitelist}" > "${adb_tmpdir}/tmp.whitelist"
     fi
-
-    # get system information
-    #
-    adb_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
 }
 
 # f_rmtemp: remove temporary files & directories
@@ -279,7 +275,6 @@ f_log()
         logger -t "adblock-[${adb_ver}] ${class}" "${log_msg}"
         if [ "${class}" = "error" ]
         then
-            f_debug
             f_rmtemp
             f_rmdns
             f_dnsrestart
@@ -317,7 +312,8 @@ f_debug()
 f_main()
 {
     local enabled url rc cnt sum_cnt=0
-    local src_name src_rset shalla_file shalla_archive
+    local src_name src_rset shalla_file shalla_archive list active_lists
+    local sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
 
     f_debug
     f_log "debug" "main   ::: tool: ${adb_fetch}, parm: ${adb_fetchparm}"
@@ -421,11 +417,11 @@ f_main()
         cnt="$(wc -l < "${src_name}")"
         sum_cnt=$((sum_cnt + cnt))
         list="${src_name/*./}"
-        if [ -z "${sum_list}" ]
+        if [ -z "${active_lists}" ]
         then
-            sum_list="\"${list}\":\"${cnt}\""
+            active_lists="\"${list}\":\"${cnt}\""
         else
-            sum_list="${sum_list},\"${list}\":\"${cnt}\""
+            active_lists="${active_lists},\"${list}\":\"${cnt}\""
         fi
     done
     f_dnsrestart
@@ -433,15 +429,17 @@ f_main()
     then
         f_debug
         f_rmtemp
-        f_log "info " "status ::: block lists with overall ${sum_cnt} domains loaded (${adb_sysver})"
+        f_log "info " "status ::: block lists with overall ${sum_cnt} domains loaded (${sysver})"
         ubus call service add "{\"name\":\"adblock_stats\",
-                                \"instances\":{\"stats\":{\"command\":[\"\"],
-                                \"data\":{\"blocked_domains\":\"${sum_cnt}\",
-                                \"last_rundate\":\"$(/bin/date "+%d.%m.%Y %H:%M:%S")\",
-                                \"active_lists\":[{${sum_list}}]}}}}"
-        exit 0
+            \"instances\":{\"stats\":{\"command\":[\"\"],
+            \"data\":{\"blocked_domains\":\"${sum_cnt}\",
+            \"last_rundate\":\"$(/bin/date "+%d.%m.%Y %H:%M:%S")\",
+            \"active_lists\":[{${active_lists}}],
+            \"system\":\"${sysver}\"}}}}"
+        return 0
     fi
-    f_log "error" "status ::: dns server restart with active block lists failed"
+    f_debug
+    f_log "error" "status ::: dns server restart with active block lists failed (${sysver})"
 }
 
 # handle different adblock actions