1 |
michel |
1.1 |
diff -urN xtables-addons-1.47.1.old/geoip/xt_geoip_dl xtables-addons-1.47.1/geoip/xt_geoip_dl |
2 |
|
|
--- xtables-addons-1.47.1.old/geoip/xt_geoip_dl 2020-01-11 11:03:01.000000000 +0400 |
3 |
michel |
1.2 |
+++ xtables-addons-1.47.1/geoip/xt_geoip_dl 2020-01-12 22:26:49.885000000 +0400 |
4 |
|
|
@@ -1,7 +1,26 @@ |
5 |
michel |
1.1 |
#!/bin/sh |
6 |
|
|
|
7 |
michel |
1.2 |
+status=$(/sbin/e-smith/config getprop geoip status) |
8 |
|
|
+if [[ "$status" != "enabled" ]] |
9 |
|
|
+then |
10 |
|
|
+ echo "Geoip is not enabled. No download." |
11 |
|
|
+ exit 1 |
12 |
|
|
+fi |
13 |
|
|
+ |
14 |
|
|
+LicenseKey=$(/sbin/e-smith/config getprop geoip LicenseKey) |
15 |
|
|
+if [ -z $LicenseKey ] |
16 |
|
|
+then |
17 |
|
|
+ echo "No License Key available. Downloading cannot be performed" |
18 |
|
|
+ exit 1 |
19 |
|
|
+fi |
20 |
michel |
1.1 |
+ |
21 |
|
|
rm -rf GeoLite2-Country-CSV_* |
22 |
|
|
|
23 |
|
|
-wget -q http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-CSV.zip |
24 |
michel |
1.2 |
+if ( ! wget -O GeoLite2-Country-CSV.zip -q "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=${LicenseKey}&suffix=zip" ) |
25 |
|
|
+then |
26 |
|
|
+ echo "Error while downloading" |
27 |
|
|
+ exit 2 |
28 |
|
|
+fi |
29 |
michel |
1.1 |
+ |
30 |
|
|
unzip -q GeoLite2-Country-CSV.zip |
31 |
|
|
rm -f GeoLite2-Country-CSV.zip |