#!/bin/sh
GITVERSION=`git describe --tags`
#GITVERSION=`echo $GITVERSION | sed 's/-\([0-9]\+-g[0-9a-fA-F]\+\)/~\1/'`
# ${GITVERSION/-g/~g}
GITVERSION=`echo $GITVERSION | sed 's/^v//'`
DEBVERSION=`head -1 debian/changelog | sed 's/.*(\(.*\)).*/\1/'`
if [ "$DEBVERSION" != "$GITVERSION" ]; then
    dch -v $GITVERSION "make release from git (see git changelog for more information)" || exit $?
fi
fakeroot debian/rules binary
