From 06263e30b4ae0ad9ea7d5a30d967f3e005fd7046 Mon Sep 17 00:00:00 2001 From: Phil Date: Sat, 25 Jan 2025 21:48:06 +0000 Subject: [PATCH] Updated geolite2-db-update.sh script to fix issue where the download of the database files would save to the wrong folder so the extract wouldn't work --- geolite2-db-update.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/geolite2-db-update.sh b/geolite2-db-update.sh index a6adca8..2fb5052 100644 --- a/geolite2-db-update.sh +++ b/geolite2-db-update.sh @@ -2,7 +2,7 @@ # Define constants BASE_URL="https://download.maxmind.com/geoip/databases" -AUTH="YOUR_ACCOUNT_ID:YOUR_LICENSE_KEY" +AUTH="OUR_ACCOUNT_ID:YOUR_LICENSE_KEY" OUTPUT_DIR="$(dirname "$0")/geolite2/db" CITY_FILE="GeoLite2-City" ASN_FILE="GeoLite2-ASN" @@ -20,13 +20,14 @@ process_file() { echo "Processing $file_name..." - curl -O -J -L -u "$AUTH" "$BASE_URL/$file_name/download?suffix=tar.gz" + # Download the .tar.gz file to the output directory + curl -o "$OUTPUT_DIR/$file_name.tar.gz" -J -L -u "$AUTH" "$BASE_URL/$file_name/download?suffix=tar.gz" - # Extract the .tar.gz file - tar -xzf "$file_name.tar.gz" --wildcards --strip-components=1 -C "$target_dir" "*/$file_name.mmdb" + # Extract the .tar.gz file into the target directory + tar -xzf "$OUTPUT_DIR/$file_name.tar.gz" --wildcards --strip-components=1 -C "$target_dir" "*/$file_name.mmdb" # Clean up the downloaded tar.gz file - rm -f "$file_name.tar.gz" + rm -f "$OUTPUT_DIR/$file_name.tar.gz" echo "$file_name processed and placed in $target_dir" } @@ -37,4 +38,3 @@ process_file "$ASN_FILE" "$OUTPUT_DIR/asn" process_file "$COUNTRY_FILE" "$OUTPUT_DIR/country" echo "All files processed successfully." -