-if ! $EDITOR debian/changelog ; then
- printf "Exiting as editing debian/changelog returned an error." >&2
- exit 1
+ cat > debian/changelog << EOF
+grml-live (${GRML_LIVE_VERSION}~autobuild${UNIXTIME}) UNRELEASED; urgency=low
+
+ * Automatically built package based on the state of
+ git repository at http://git.grml.org/?p=grml-live.git
+ on $DATE
+
+ -- grml-live Auto Build <mika@grml.org> $DATE
+
+EOF
+ git add debian/changelog
+ git commit -m "Releasing ${GRML_LIVE_VERSION}-~autobuild${UNIXTIME} (auto build)"
+else
+ since=v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')
+ git-dch --ignore-branch --since=$since \
+ --id-length=7 --meta --multimaint-merge -S
+ printf "OK\n"
+fi
+
+if [ -z "${AUTOBUILD:-}" ] ; then
+ if ! $EDITOR debian/changelog ; then
+ printf "Exiting as editing debian/changelog returned an error." >&2
+ exit 1
+ fi