#!/usr/bin/make -f

VARIANT = quickstart
DEBVERS := $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
UPSTREAM_VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/^[[:digit:]]*://' -e 's/[~-].*//')

ORIGINAL_DUMP = postbooks_$(VARIANT)-$(UPSTREAM_VERSION).backup
SQL_FILE = `basename $(ORIGINAL_DUMP) .backup`.sql

%:
	dh $@ --builddirectory=.

override_dh_auto_build:
	gzip < $(SQL_FILE) > $(SQL_FILE).gz

# convenience target for maintainer to update the source package:
unpack_pgdump:
	pg_restore -f $(SQL_FILE) $(ORIGINAL_DUMP)

