From 0b6cc4aa4e5d1915bace5486fc2ca32bfb94ebc2 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Fri, 29 Aug 2025 09:52:21 +0200 Subject: [PATCH] cron/geoip-update-db.sh --- bin/gen/geoip | 14 -------------- cron/geoip-update-db.sh | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 14 deletions(-) delete mode 100755 bin/gen/geoip create mode 100755 cron/geoip-update-db.sh diff --git a/bin/gen/geoip b/bin/gen/geoip deleted file mode 100755 index cb1ac4066f6..00000000000 --- a/bin/gen/geoip +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -e - -# Use .env file, if it exists. -if test -f .env; then - export $(egrep -v '^#' .env | xargs) -fi - -mkdir -p data -cd data -curl -L https://download.maxmind.com/app/geoip_download\?edition_id\=GeoLite2-City\&license_key\=$MAXMIND_KEY\&suffix\=tar.gz -o GeoLite2-City.mmdb.tar.gz -tar xvzf GeoLite2-City.mmdb.tar.gz -mv GeoLite2-City_*/GeoLite2-City.mmdb ./ -rm -rf GeoLite2-City_* -cd - diff --git a/cron/geoip-update-db.sh b/cron/geoip-update-db.sh new file mode 100755 index 00000000000..56e6586e449 --- /dev/null +++ b/cron/geoip-update-db.sh @@ -0,0 +1,20 @@ +#!/bin/sh -e + +LILA_DIR="$(dirname -- $0)/.." +DATA_DIR="$LILA_DIR/data" +TGZ_FILE="GeoLite2-City.mmdb.tar.gz" + +if [ -z "$MAXMIND_KEY" ]; then + echo "MAXMIND_KEY is not set, exiting" + exit 1 +fi + +echo "Downloading GeoLite2-City database to $DATA_DIR/$TGZ_FILE" + +mkdir -p $DATA_DIR +cd $DATA_DIR +curl -L https://download.maxmind.com/app/geoip_download\?edition_id\=GeoLite2-City\&license_key\=$MAXMIND_KEY\&suffix\=tar.gz -o $TGZ_FILE +tar xvzf $TGZ_FILE +mv GeoLite2-City_*/GeoLite2-City.mmdb ./ +rm -rf GeoLite2-City_* +cd -