#!/bin/sh

set -eux

wget --mirror http://www.dk9tn.de/downloads/WAG_call_history.txt

VERSION="$(grep 'Compiled by' www.dk9tn.de/downloads/WAG_call_history.txt | cut -d ' ' -f 7 | tr -d '.')"
OLDVERSION=$(cat wag.date)
if [ "$VERSION" != "$OLDVERSION" ]; then
  dch "Update WAG call file to version $VERSION."
  echo "$VERSION" > wag.date
fi
