]> git.ipfire.org Git - people/jschlag/pbs.git/blob - src/tools/update-geoip-database.sh
jobs: Fix some direct accesses to self._data
[people/jschlag/pbs.git] / src / tools / update-geoip-database.sh
1 #!/bin/bash
2
3 URL="http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz"
4
5 tmpfile=$(mktemp)
6
7 # Download the file
8 if ! wget "${URL}" -O "${tmpfile}"; then
9 echo "Could not download the database file" >&2
10 unlink "${tmpfile}"
11
12 exit 1
13 fi
14
15 # Extract database from tarball
16 if ! 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
21 fi
22
23 echo "OK"
24 exit 0