Merge pull request #8149 from Mailaender/fetch-geoip-db
Automatized GeoIP database download
This commit is contained in:
19
thirdparty/fetch-geoip-db.sh
vendored
Executable file
19
thirdparty/fetch-geoip-db.sh
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Die on any error for Travis CI to automatically retry:
|
||||
set -e
|
||||
|
||||
download_dir="${0%/*}/download"
|
||||
mkdir -p "${download_dir}"
|
||||
cd "${download_dir}"
|
||||
|
||||
filename="GeoLite2-Country.mmdb.gz"
|
||||
|
||||
# Database does not exist or is older than 30 days.
|
||||
if [[ ! -e $filename ]] || [[ -n $(find . -name $filename -mtime +30 -print) ]]; then
|
||||
rm -f $filename
|
||||
echo "Updating GeoIP country database from MaxMind."
|
||||
curl -s -L -O http://geolite.maxmind.com/download/geoip/database/$filename
|
||||
cp $filename ../..
|
||||
fi
|
||||
|
||||
8
thirdparty/fetch-thirdparty-deps.ps1
vendored
8
thirdparty/fetch-thirdparty-deps.ps1
vendored
@@ -130,4 +130,12 @@ if (!(Test-Path "Eluant.dll"))
|
||||
(New-Object System.Net.WebClient).DownloadFile("https://github.com/OpenRA/Eluant/releases/download/20140425/Eluant.dll", $target)
|
||||
}
|
||||
|
||||
if (!(Test-Path "GeoLite2-Country.mmdb.gz") -Or (((get-date) - (get-item "GeoLite2-Country.mmdb").LastWriteTime) -gt (new-timespan -days 30)))
|
||||
{
|
||||
echo "Updating GeoIP country database from MaxMind."
|
||||
$target = Join-Path $pwd.ToString() "GeoLite2-Country.mmdb.gz"
|
||||
(New-Object System.Net.WebClient).DownloadFile("http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz", $target)
|
||||
cp GeoLite2-Country.mmdb.gz ..\..
|
||||
}
|
||||
|
||||
cd ..
|
||||
|
||||
Reference in New Issue
Block a user