banip: update to 0.8.2-5
* fixed missing version number when installed as separate package (not in build) * fixed cornercase init and mailing issues * sorted Country list by country names ascending * fixed some shellcheck findings Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
parent
797f7b44aa
commit
c9bf92c88d
5 changed files with 42 additions and 33 deletions
|
@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
|||
|
||||
PKG_NAME:=banip
|
||||
PKG_VERSION:=0.8.2
|
||||
PKG_RELEASE:=4
|
||||
PKG_RELEASE:=5
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ f_system() {
|
|||
local cpu core
|
||||
|
||||
ban_memory="$("${ban_awkcmd}" '/^MemAvailable/{printf "%s",int($2/1000)}' "/proc/meminfo" 2>/dev/null)"
|
||||
ban_ver="$(${ban_ubuscmd} -S call rpc-sys packagelist 2>/dev/null | jsonfilter -ql1 -e '@.packages.banip')"
|
||||
ban_ver="$(${ban_ubuscmd} -S call rpc-sys packagelist '{ "all": true }' 2>/dev/null | jsonfilter -ql1 -e '@.packages.banip')"
|
||||
ban_sysver="$(${ban_ubuscmd} -S call system board 2>/dev/null | jsonfilter -ql1 -e '@.model' -e '@.release.description' |
|
||||
"${ban_awkcmd}" 'BEGIN{RS="";FS="\n"}{printf "%s, %s",$1,$2}')"
|
||||
if [ -z "${ban_cores}" ]; then
|
||||
|
@ -928,7 +928,7 @@ f_genstatus() {
|
|||
# get status information
|
||||
#
|
||||
f_getstatus() {
|
||||
local key keylist type value index_key1 index_key2 index_value1 index_value2 actual="${1}"
|
||||
local key keylist type value index_key1 index_key2 index_value1 index_value2
|
||||
|
||||
[ -z "${ban_dev}" ] && f_conf
|
||||
json_load_file "${ban_rtfile}" >/dev/null 2>&1
|
||||
|
@ -1262,7 +1262,11 @@ f_mail() {
|
|||
|
||||
# load mail template
|
||||
#
|
||||
[ -r "${ban_mailtemplate}" ] && . "${ban_mailtemplate}" || f_log "info" "the mail template is missing"
|
||||
if [ -r "${ban_mailtemplate}" ]; then
|
||||
. "${ban_mailtemplate}"
|
||||
else
|
||||
f_log "info" "the mail template is missing"
|
||||
fi
|
||||
[ -z "${mail_text}" ] && f_log "info" "the 'mail_text' template variable is empty"
|
||||
[ "${ban_debug}" = "1" ] && msmtp_debug="--debug"
|
||||
|
||||
|
|
|
@ -138,8 +138,13 @@ hold="$((cnt % ban_cores))"
|
|||
f_rmset
|
||||
f_rmdir "${ban_tmpdir}"
|
||||
f_genstatus "active"
|
||||
[ "${ban_mailnotification}" = "1" ] && [ -n "${ban_mailreceiver}" ] && [ -x "${ban_mailcmd}" ] && f_mail
|
||||
f_log "info" "finished banIP download processes"
|
||||
if [ "${ban_mailnotification}" = "1" ] && [ -n "${ban_mailreceiver}" ] && [ -x "${ban_mailcmd}" ]; then
|
||||
(
|
||||
sleep ${ban_triggerdelay}
|
||||
f_mail
|
||||
) &
|
||||
fi
|
||||
rm -rf "${ban_lock}"
|
||||
|
||||
# start detached log service
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
tw;Taiwan
|
||||
af;Afghanistan
|
||||
ax;Åland Islands
|
||||
al;Albania
|
||||
dz;Algeria
|
||||
as;American Samoa
|
||||
|
@ -25,7 +25,6 @@ bj;Benin
|
|||
bm;Bermuda
|
||||
bt;Bhutan
|
||||
bo;Bolivia
|
||||
bq;Caribbean Netherlands
|
||||
ba;Bosnia
|
||||
bw;Botswana
|
||||
bv;Bouvet Island
|
||||
|
@ -36,32 +35,30 @@ bn;Brunei
|
|||
bg;Bulgaria
|
||||
bf;Burkina Faso
|
||||
bi;Burundi
|
||||
cv;Cape Verde
|
||||
kh;Cambodia
|
||||
cm;Cameroon
|
||||
ca;Canada
|
||||
cv;Cape Verde
|
||||
bq;Caribbean Netherlands
|
||||
ky;Cayman Islands
|
||||
cf;Central African Republic
|
||||
td;Chad
|
||||
cl;Chile
|
||||
cn;China
|
||||
hk;Hong Kong
|
||||
mo;Macau
|
||||
cx;Christmas Island
|
||||
cc;Cocos (Keeling) Islands
|
||||
co;Colombia
|
||||
km;Comoros
|
||||
cg;Congo - Brazzaville
|
||||
cd;Congo - Kinshasa
|
||||
ck;Cook Islands
|
||||
cr;Costa Rica
|
||||
ci;Côte d’Ivoire
|
||||
hr;Croatia
|
||||
cu;Cuba
|
||||
cw;Curaçao
|
||||
cy;Cyprus
|
||||
cz;Czechia
|
||||
ci;Côte d’Ivoire
|
||||
kp;North Korea
|
||||
cd;Congo - Kinshasa
|
||||
dk;Denmark
|
||||
dj;Djibouti
|
||||
dm;Dominica
|
||||
|
@ -100,8 +97,8 @@ gw;Guinea-Bissau
|
|||
gy;Guyana
|
||||
ht;Haiti
|
||||
hm;Heard & McDonald Islands
|
||||
va;Vatican City
|
||||
hn;Honduras
|
||||
hk;Hong Kong
|
||||
hu;Hungary
|
||||
is;Iceland
|
||||
in;India
|
||||
|
@ -130,6 +127,7 @@ ly;Libya
|
|||
li;Liechtenstein
|
||||
lt;Lithuania
|
||||
lu;Luxembourg
|
||||
mo;Macau
|
||||
mg;Madagascar
|
||||
mw;Malawi
|
||||
my;Malaysia
|
||||
|
@ -143,6 +141,7 @@ mu;Mauritius
|
|||
yt;Mayotte
|
||||
mx;Mexico
|
||||
fm;Micronesia
|
||||
md;Moldova
|
||||
mc;Monaco
|
||||
mn;Mongolia
|
||||
me;Montenegro
|
||||
|
@ -162,10 +161,13 @@ ng;Nigeria
|
|||
nu;Niue
|
||||
nf;Norfolk Island
|
||||
mp;Northern Mariana Islands
|
||||
kp;North Korea
|
||||
mk;North Macedonia
|
||||
no;Norway
|
||||
om;Oman
|
||||
pk;Pakistan
|
||||
pw;Palau
|
||||
ps;Palestine
|
||||
pa;Panama
|
||||
pg;Papua New Guinea
|
||||
py;Paraguay
|
||||
|
@ -176,19 +178,10 @@ pl;Poland
|
|||
pt;Portugal
|
||||
pr;Puerto Rico
|
||||
qa;Qatar
|
||||
kr;South Korea
|
||||
md;Moldova
|
||||
re;Réunion
|
||||
ro;Romania
|
||||
ru;Russia
|
||||
rw;Rwanda
|
||||
re;Réunion
|
||||
bl;St. Barthélemy
|
||||
sh;St. Helena
|
||||
kn;St. Kitts & Nevis
|
||||
lc;St. Lucia
|
||||
mf;St. Martin
|
||||
pm;St. Pierre & Miquelon
|
||||
vc;St. Vincent & Grenadines
|
||||
ws;Samoa
|
||||
sm;San Marino
|
||||
st;São Tomé & Príncipe
|
||||
|
@ -205,19 +198,27 @@ sb;Solomon Islands
|
|||
so;Somalia
|
||||
za;South Africa
|
||||
gs;South Georgia & South Sandwich Islands
|
||||
kr;South Korea
|
||||
ss;South Sudan
|
||||
es;Spain
|
||||
lk;Sri Lanka
|
||||
ps;Palestine
|
||||
bl;St. Barthélemy
|
||||
sh;St. Helena
|
||||
kn;St. Kitts & Nevis
|
||||
lc;St. Lucia
|
||||
mf;St. Martin
|
||||
pm;St. Pierre & Miquelon
|
||||
vc;St. Vincent & Grenadines
|
||||
sd;Sudan
|
||||
sr;Suriname
|
||||
sj;Svalbard & Jan Mayen
|
||||
se;Sweden
|
||||
ch;Switzerland
|
||||
sy;Syria
|
||||
tw;Taiwan
|
||||
tj;Tajikistan
|
||||
tz;Tanzania
|
||||
th;Thailand
|
||||
mk;North Macedonia
|
||||
tl;Timor-Leste
|
||||
tg;Togo
|
||||
tk;Tokelau
|
||||
|
@ -232,13 +233,13 @@ ug;Uganda
|
|||
ua;Ukraine
|
||||
ae;United Arab Emirates
|
||||
gb;United Kingdom
|
||||
tz;Tanzania
|
||||
um;U.S. Outlying Islands
|
||||
vi;U.S. Virgin Islands
|
||||
us;United States
|
||||
uy;Uruguay
|
||||
um;U.S. Outlying Islands
|
||||
vi;U.S. Virgin Islands
|
||||
uz;Uzbekistan
|
||||
vu;Vanuatu
|
||||
va;Vatican City
|
||||
ve;Venezuela
|
||||
vn;Vietnam
|
||||
wf;Wallis & Futuna
|
||||
|
@ -246,4 +247,3 @@ eh;Western Sahara
|
|||
ye;Yemen
|
||||
zm;Zambia
|
||||
zw;Zimbabwe
|
||||
ax;Åland Islands
|
||||
|
|
|
@ -19,6 +19,7 @@ ban_funlib="/usr/lib/banip-functions.sh"
|
|||
ban_pidfile="/var/run/banip.pid"
|
||||
ban_lock="/var/run/banip.lock"
|
||||
|
||||
[ "${action}" = "boot" ] && /etc/init.d/banip running && exit 0
|
||||
[ "${action}" = "stop" ] && ! /etc/init.d/banip running && exit 0
|
||||
[ ! -r "${ban_funlib}" ] && { [ "${action}" = "start" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "stop" ] || [ "${action}" = "report" ] || [ "${action}" = "search" ] || [ "${action}" = "survey" ] || [ "${action}" = "status" ]; } && exit 1
|
||||
[ -d "${ban_lock}" ] && { [ "${action}" = "start" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ]; } && exit 1
|
||||
|
@ -60,6 +61,7 @@ stop_service() {
|
|||
"${ban_nftcmd}" delete table inet banIP >/dev/null 2>&1
|
||||
f_genstatus "stopped"
|
||||
f_rmpid
|
||||
rm -rf "${ban_lock}"
|
||||
}
|
||||
|
||||
restart() {
|
||||
|
@ -72,10 +74,8 @@ status() {
|
|||
}
|
||||
|
||||
status_service() {
|
||||
local actual="${1}"
|
||||
|
||||
[ -z "$(command -v "f_system")" ] && . "${ban_funlib}"
|
||||
[ -n "${actual}" ] && f_actual || f_getstatus
|
||||
f_getstatus
|
||||
}
|
||||
|
||||
report() {
|
||||
|
|
Loading…
Reference in a new issue