summaryrefslogtreecommitdiffstats
path: root/src/test/test6.sh
blob: 3bbcc445fbb4ea4ac3ccd22cfc3f70297fd76097 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh -xe

mmdb=
for dir in /var/lib/GeoIP /usr/share/GeoIP /usr/local/share/GeoIP "$HOME/GeoIP"; do
    if [ -f "$dir/GeoLite2-ASN.mmdb" -a -f "$dir/GeoLite2-Country.mmdb" ]; then
        mmdb="$dir"
        break
    fi
done
if [ -z "$mmdb" ]; then
    exit 0
fi

cp "$srcdir/mmdb.conf" mmdb.conf.run
echo "maxminddb_asn \"$mmdb/GeoLite2-ASN.mmdb\";" >> mmdb.conf.run
echo "maxminddb_country \"$mmdb/GeoLite2-Country.mmdb\";" >> mmdb.conf.run

rm -f 1458044657.dscdata.xml

../dsc mmdb.conf.run

test -f 1458044657.dscdata.xml || sleep 1
test -f 1458044657.dscdata.xml || sleep 2
test -f 1458044657.dscdata.xml || sleep 3
test -f 1458044657.dscdata.xml
grep -q ASN 1458044657.dscdata.xml
grep -q CountryCode 1458044657.dscdata.xml