2024-09-07 08:46:09 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Original script from xtables-addons
|
|
|
|
# SME specific use of ConfigDB
|
|
|
|
# replace /usr/libexec/xtables-addons/xt_geoip_dl in /usr/share/xt_geoip/update_base
|
2025-02-13 19:14:51 +01:00
|
|
|
# Koozali SME v11
|
|
|
|
# Now migrated to using files in /usr/share/xt_geoip
|
|
|
|
|
2024-09-07 08:46:09 +02:00
|
|
|
|
|
|
|
status=$(/sbin/e-smith/config getprop geoip status)
|
|
|
|
if [[ "$status" != "enabled" ]]
|
|
|
|
then
|
|
|
|
echo "Geoip is not enabled. No download."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
LicenseKey=$(/sbin/e-smith/config getprop geoip LicenseKey)
|
|
|
|
if [ -z $LicenseKey ]
|
|
|
|
then
|
|
|
|
echo "No License Key available. Downloading cannot be performed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf GeoLite2-Country-CSV_*
|
|
|
|
|
|
|
|
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" )
|
|
|
|
then
|
|
|
|
echo "Error while downloading"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2025-02-13 19:14:51 +01:00
|
|
|
# unzip -q GeoLite2-Country-CSV.zip
|
|
|
|
if [ ! -d "/usr/share/xt_geoip/GeoLite2-Country-CSV" ]; then
|
|
|
|
mkdir -p "/usr/share/xt_geoip/GeoLite2-Country-CSV";
|
|
|
|
fi
|
|
|
|
unzip -o -q -j GeoLite2-Country-CSV.zip -d /usr/share/xt_geoip/GeoLite2-Country-CSV
|
2024-09-07 08:46:09 +02:00
|
|
|
rm -f GeoLite2-Country-CSV.zip
|