Last active
July 22, 2024 15:16
-
-
Save revenkroz/cff91f350b5c90f5e740977c53d06ea0 to your computer and use it in GitHub Desktop.
Script to download MaxMind DB and extract it immediately
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export GEOIP_EDITION='GeoLite2-Country' | |
export GEOIP_LICENCE_KEY='secret_licence_key' | |
export GEOIP_TMP_FILE=geoip.tar.gz | |
curl -sSL "https://download.maxmind.com/app/geoip_download?edition_id=${GEOIP_EDITION}&license_key=${GEOIP_LICENCE_KEY}&suffix=tar.gz" > $GEOIP_TMP_FILE && \ | |
tar -xzf $GEOIP_TMP_FILE --wildcards "*/${GEOIP_EDITION}.mmdb" --strip=1 && \ | |
rm $GEOIP_TMP_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MaxMind now uses redirects, so you have to add the "-L" option to curl, like this: