#!/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