colonnade/geolite-csv/scripts/load-full-databases
2016-07-13 17:33:38 -04:00

36 lines
583 B
Bash
Executable File

#!/bin/bash
set -e
current_dir="${PWD##*/}"
echo "Current directory is: $current_dir"
if [ "$current_dir" = "colonnade" ]
then
cd ./geolite-csv
fi
new_current_dir="${PWD##*/}"
if [ "$new_current_dir" != "geolite-csv" ]
then
echo "Not currently in the geolite project directory. Exiting."
exit 1
fi
mkdir -p ./data/large
cd ./data/large
rm -f *.zip
rm -rf GeoLite2-*
curl 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-City-CSV.zip' > archive.zip
unzip archive.zip -d ./
cd GeoLite2-City-CSV*
mv *.csv ../
cd ../
rm -rf GeoLite2-City-CSV*
rm archive.zip