summaryrefslogtreecommitdiff
path: root/data/live-build-config/hooks/live/40-init-geoip-database.chroot
blob: 4f9186c32144332c4f2bbbf2f2e741ce77bb223b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

# Geolocation data provided by DB-IP.com
# License: https://creativecommons.org/licenses/by/4.0/ (CC BY 4.0)

DATE_SUFFIX=$(date +%Y-%m)
URL="https://download.db-ip.com/free/dbip-country-lite-${DATE_SUFFIX}.csv.gz"
OUT_PATH="/usr/share/vyos-geoip/dbip-country-lite.csv.gz"

mkdir -p $(dirname $OUT_PATH)
wget -O - $URL > $OUT_PATH

if [ $? -ne 0 ]; then
    echo "Failed to download GeoIP database"
    rm $OUT_PATH
fi