fetch GeoLite2-Country.mmdb.gz after 30 days of file age

This commit is contained in:
Matthias Mailänder
2015-05-11 23:44:02 +02:00
parent 8e919d3215
commit a2c553478d
7 changed files with 33 additions and 4 deletions

View File

@@ -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 ..