]> git.ipfire.org Git - people/jschlag/pbs.git/blame - src/tools/update-geoip-database.sh
Fix rendering mirrors page
[people/jschlag/pbs.git] / src / tools / update-geoip-database.sh
CommitLineData
d3e7a9fb
MT
1#!/bin/bash
2
3URL="http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz"
4
5tmpfile=$(mktemp)
6
7# Download the file
8if ! wget "${URL}" -O "${tmpfile}"; then
9 echo "Could not download the database file" >&2
10 unlink "${tmpfile}"
11
12 exit 1
13fi
14
15# Extract database from tarball
16if ! tar xvOf "${tmpfile}" "*/GeoLite2-Country.mmdb" > src/geoip/GeoLite2-Country.mmdb; then
17 echo "Could not extract the database" >&2
18 unlink "${tmpfile}"
19
20 exit 1
21fi
22
23echo "OK"
24exit 0