diff --git a/README b/README
index 8551e11..43d64ac 100644
--- a/README
+++ b/README
@@ -10,7 +10,8 @@ license:
*) For more information, please refer to
what's new in v8.6:
-*) major updating
+*) move variables that located in grab_http to grab_config
+*) updating grab_http and grab_library
Get url to download script-pack (latest version) :
~ curl -s https://api.github.com/repos/ngadmini/Grabbing-Blacklist-for-Bind9-RPZ/releases/latest \
@@ -86,6 +87,9 @@ prerequisites:
# specify in fqdn or ip-address
HOST=rpz.warnet-ersa.net
+ # fixed number of lines grab_regex
+ REGEX=4
+
# reload Remote Name Daemon Control (rndc)
# set 'yes' to run or 'no' to
RNDC_RELOAD=yes
@@ -104,6 +108,9 @@ prerequisites:
# NS-IP Trigger with NXDOMAIN Action for ip-address-list
RPZ_IPV=rpz-nsip CNAME .
+ # fixed number of lines grab_urls
+ URLS=22
+
# change to directory where zone-files (rpz.* and db.*) are located in bind9-server
ZONE_DIR=/var/bind9/chroot/etc/bind/zones-rpz
diff --git a/libs/grab_config b/libs/grab_config
index 164fb51..869771b 100644
--- a/libs/grab_config
+++ b/libs/grab_config
@@ -14,16 +14,17 @@
# like in grab_library, instead of changing them here directly.
# go to grab_library line:
# ~ nano +$(grep -n 'f_dft()' grab_library | cut -d: -f1) grab_library
-###########################################################################
+##################################################################################
-# identify clearly and with certainty host-name in FQDN
-# or ip-address of your bind9-server
-# use fqdn
+# identify clearly and with certainty host-name in FQDN or ip-address bind9-server
+# use fqdn or ip-address
# HOST=rpz.warnet-ersa.net
-# or ip-address
# HOST=172.30.254.253
HOST=rpz.warnet-ersa.net
+# fixed number of lines grab_regex
+REGEX=4
+
# bind9-server need reload rndc (Remote Name Daemon Control)
# after syncronizing new dataBASE. but some server with low_RAM
# will out off memory. in this case you could 'reboot' it.
@@ -46,6 +47,8 @@ RNDC_RELOAD=no
RPZ_DOM=CNAME .
RPZ_IPV=rpz-nsip CNAME .
+# fixed number of lines grab_urls
+URLS=22
+
# change to directory where zone-files (rpz.*) and db-files (db.*) are located
-#ZONE_DIR=/var/bind9/chroot/etc/bind/zones-rpz
ZONE_DIR=/etc/bind/zones-rpz
diff --git a/libs/grab_http.sh b/libs/grab_http.sh
index b207bf6..740f8fa 100644
--- a/libs/grab_http.sh
+++ b/libs/grab_http.sh
@@ -41,12 +41,10 @@ f_ok
ar_shy=(grab_build.sh grab_cereal.sh grab_duplic.sh grab_rsync.sh)
ar_shn=(grab_regex grab_urls)
ar_pac=()
-
declare -A ar_num # numeric value
ar_num[ar_txt]=1 # index's position of: ipv4 category is no.1 at ar_txt
ar_num[ar_shn]=0 #+ grab_regex is no.0 at ar_shn
-ar_num[ar_url]=22 # fixed number of lines: grab_urls
-ar_num[ar_reg]=4 #+ grab_regex
+f_cnf
# requirement inspection
printf "${_pre} %-63s" "check required debian-packages in local-host: $(hostname -I)"
@@ -94,17 +92,17 @@ for E in "${!ar_shn[@]}"; do
if [[ ${E} -eq ${ar_num[ar_shn]} ]]; then
mapfile -t ar_reg < "${ar_shn[E]}"
- [[ ${#ar_reg[@]} -eq ${ar_num[ar_reg]} ]] || f_xcd 249 "${ar_shn[E]}"
+ [[ ${#ar_reg[@]} -eq ${REGEX} ]] || f_xcd 249 "${ar_shn[E]}"
else
mapfile -t ar_url < "${ar_shn[E]}"
- [[ ${#ar_url[@]} -eq ${ar_num[ar_url]} ]] || f_xcd 248 "${ar_shn[E]}"
+ [[ ${#ar_url[@]} -eq ${URLS} ]] || f_xcd 248 "${ar_shn[E]}"
fi
done
f_ok
printf "${_pre} check availability of remote-files (in %s)\n" "${ar_shn[1]}"
f_uri "${ar_shn[1]}" || :
-f_grb # initialize, grabbing and processing raw-domains (CATEGORY)
+f_grb # initialize, grabbing and processing raw-domains (CATEGORY)
# category: TRUST+ --> ${ar_cat[5]} with 3 additional entries: ${ar_url[1,7]}
# contents: gambling and [TRUST+Positif](https://trustpositif.kominfo.go.id/)
diff --git a/libs/grab_library b/libs/grab_library
index d539a26..3d3793a 100644
--- a/libs/grab_library
+++ b/libs/grab_library
@@ -99,7 +99,6 @@ f_xcd() { # exit code {244..255}
}
f_sm0() { # display offering options
- f_cnf
printf "${_wn1} there are still remaining duplicate entries between CATEGORIES\n"
printf "${_hnt} consider continue to next TASKs\n"
printf "${_CYN}\n" "you have 4 options to proceed to the next task:"
@@ -327,11 +326,13 @@ f_sta() { if [[ $(stat -c "%a" "$2") != "$1" ]]; then chmod "$1" "$2"; fi; }
f_stt() { printf "\n${_RED}\nstarting ${0##*/} ${_ver} at ${_CYN}\n" "$1" "${_lct}"; f_ver; }
f_dft() { # define default values in grab_config
- printf "${_inf} forking ${_CYN} with default configurations:\n" "${_foo}"
+ printf "${_inf} forking ${_CYN} with default configurations\n" "${_foo}"
: "${HOST:=rpz.warnet-ersa.net}" # or ip-address
+ : "${REGEX:=4}" # fixed number of lines grab_regex
: "${RNDC_RELOAD:=no}" # yes OR no
: "${RPZ_DOM:=CNAME .}" # rpz policy
- : "${RPZ_IPV:=rpz-nsip CNAME .}" #
+ : "${RPZ_IPV:=rpz-nsip CNAME .}" #+
+ : "${URLS:=22}" # fixed number of lines grab_urls
: "${ZONE_DIR:=/etc/bind/zones-rpz}" # target dir for rsync
}
@@ -340,7 +341,7 @@ f_cnf() { # valuation variables in grab_config
local _ptr="s/=[ ^ ]/=/g;s/['\"]//g;s/[#;].*//g;s/[[:space:]]+/ /g;s/[[:space:]]$//g"
if [[ -e ${CNF} ]]; then
f_sta 644 "${CNF}"
- ar_cnf=(HOST RNDC_RELOAD RPZ_DOM RPZ_IPV ZONE_DIR)
+ ar_cnf=(HOST REGEX RNDC_RELOAD RPZ_DOM RPZ_IPV URLS ZONE_DIR)
mapfile -t ar_CNF < <(_srt "${CNF}" | _grp -E "^[A-Z]" | _sed "s/[ ^ ]=/=/g" | cut -d= -f1)
if [[ ${ar_CNF[*]} == "${ar_cnf[*]}" ]]; then
mapfile -t ar_VAR < <(_srt "${CNF}" | _grp -E "^[A-Z]" | _sed "${_ptr}" | cut -d= -f2)