#!/bin/sh
set -e
set -x
-cd pdns-recursor-$1
+
+if [ -z "$1" ]; then
+ VERSION=$(git describe --always --dirty=+ 2>/dev/null || true)
+ if [ -z "$VERSION" ]; then
+ VERSION="UNKNOWN"
+ else
+ VERSION="git-"$VERSION
+ fi
+ DIST_HOST="$(id -u -n)@$(hostname -f || hostname)"
+else
+ VERSION=$1
+fi
+
+cd pdns-recursor-$VERSION
export DEBFULLNAME="PowerDNS.COM BV"
-if echo $1 | grep -q ^git
+if echo $VERSION | grep -q ^git
then
- DEBPKGNAME=pdns-recursor_0.0-$1
+ DEBPKGNAME=pdns-recursor_0.0-$VERSION
else
- DEBPKGNAME=pdns-recursor_$1
+ DEBPKGNAME=pdns-recursor_$VERSION
fi
-dh_make -e powerdns.support@powerdns.com -s -f ../pdns-recursor-$1.tar.bz2 -p $DEBPKGNAME < /dev/null
+dh_make -e powerdns.support@powerdns.com -s -f ../pdns-recursor-$VERSION.tar.bz2 -p $DEBPKGNAME < /dev/null
cp pdns-recursor.init.d debian/init.d
-#[ -e debian/control ] || dh_make -e powerdns.support@powerdns.com -s -r cdbs -f ../pdns-recursor-$1.tar.bz2 < /dev/null
+#[ -e debian/control ] || dh_make -e powerdns.support@powerdns.com -s -r cdbs -f ../pdns-recursor-$VERSION.tar.bz2 < /dev/null
perl -i -pe 's/Description: <.*>/Description: extremely powerful and versatile recursing nameserver/' debian/control
# only to be nice to people usind the generated .dsc
perl -i -pe 's/(Build-Depends: .*)/$1, libboost-dev, libboost-serialization-dev, liblua5.1-0-dev/' debian/control