#!/bin/bash

set -e

dh_testdir debian/changelog

DIR=debian/geolocation
mkdir -p $DIR

pushd $DIR

BASEURL="https://download.geonames.org/export/dump/"
for F in allCountries.zip countryInfo.txt admin1CodesASCII.txt admin2Codes.txt featureCodes_en.txt alternateNamesV2.zip; do
	wget "$BASEURL/$F"
done

for Z in *.zip; do
	unzip $Z && rm $Z
done

popd

./build_geolocation -o $DIR/out $DIR/allCountries.txt

ls -l $DIR/out/Geolocation.dat ./lib/Image/ExifTool/Geolocation.dat
