Skip to content

Commit bd827e7

Browse files
authored
Merge pull request #1215 from sarthurdev/geoip
geoip: T5746: Download ASN database
2 parents b871f49 + ea19696 commit bd827e7

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

data/live-build-config/hooks/live/40-init-geoip-database.chroot

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,24 @@ DATE_SUFFIX=$(date +%Y-%m)
77
URL="https://download.db-ip.com/free/dbip-country-lite-${DATE_SUFFIX}.csv.gz"
88
OUT_PATH="/usr/share/vyos-geoip/dbip-country-lite.csv.gz"
99

10+
ASN_URL="https://download.db-ip.com/free/dbip-asn-lite-${DATE_SUFFIX}.csv.gz"
11+
ASN_OUT_PATH="/usr/share/vyos-geoip/dbip-asn-lite.csv.gz"
12+
1013
mkdir -p $(dirname $OUT_PATH)
11-
wget -O - $URL > $OUT_PATH
14+
curl -sSfL -o $OUT_PATH $URL
1215

1316
if [ $? -ne 0 ]; then
14-
echo "Failed to download GeoIP database"
17+
echo "Failed to download GeoIP country-code database"
1518
rm $OUT_PATH
1619
fi
1720

21+
mkdir -p $(dirname $ASN_OUT_PATH)
22+
curl -sSfL -o $ASN_OUT_PATH $ASN_URL
23+
24+
if [ $? -ne 0 ]; then
25+
echo "Failed to download GeoIP ASN database"
26+
rm $ASN_OUT_PATH
27+
fi
28+
1829
# Generate sqlite database
1930
python3 /usr/libexec/vyos/geoip-update.py --init

data/live-build-config/rootfs/excludes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ usr/local/games/*
4545

4646
# T5511: We do not need any caches on the system (will be recreated when needed).
4747
# T7278: We need directory created by python3-cracklib for password checks
48+
# T7926: VyOS GeoIP database location
4849
var/cache/!(cracklib|vyos)
4950

5051
# T5511: We do not need any log-files on the system (will be recreated when needed).

0 commit comments

Comments
 (0)