X-Git-Url: http://andersk.mit.edu/gitweb/config-package-dev.git/blobdiff_plain/ab8e2a67ce47fada2ae30371f954ab9dd570245c..dd49a2d50d0a03e9159ac4ac6f35fbfed8ed70b1:/debconf-divert.mk diff --git a/debconf-divert.mk b/debconf-divert.mk index eb132c1..84de2d5 100644 --- a/debconf-divert.mk +++ b/debconf-divert.mk @@ -27,8 +27,11 @@ DEB_DEBCONF_HACK_SCRIPT = /usr/share/config-package-dev/debconf-hack.sh DEB_DEBCONF_HACK_PACKAGES += $(foreach package,$(DEB_ALL_PACKAGES), \ $(if $(wildcard debian/$(package).debconf-hack),$(package))) +dh_compat_5 := $(shell if [ '$(DH_COMPAT)' -ge 5 ]; then echo y; fi) + $(patsubst %,debian-debconf-hack/%,$(DEB_DEBCONF_HACK_PACKAGES)) :: debian-debconf-hack/%: - ( \ + set -e; \ + { \ cat $(DEB_DEBCONF_HACK_SCRIPT); \ echo 'if [ ! -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \ echo ' debconf_get $(shell cut -d' ' -f2 debian/$(cdbs_curpkg).debconf-hack) >/var/cache/$(cdbs_curpkg).debconf-save'; \ @@ -36,21 +39,33 @@ $(patsubst %,debian-debconf-hack/%,$(DEB_DEBCONF_HACK_PACKAGES)) :: debian-debco sed 's/$$/ true/' debian/$(cdbs_curpkg).debconf-hack; \ echo 'EOF'; \ echo 'fi'; \ - ) >> $(CURDIR)/debian/$(cdbs_curpkg).preinst.debhelper - ( \ + } >> $(CURDIR)/debian/$(cdbs_curpkg).preinst.debhelper + set -e; \ + { \ cat $(DEB_DEBCONF_HACK_SCRIPT); \ echo 'if [ -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \ echo ' debconf_set > $(CURDIR)/debian/$(cdbs_curpkg).postinst.debhelper - ( \ + } >> $(CURDIR)/debian/$(cdbs_curpkg).postinst.debhelper + set -e; \ + { \ + $(if $(dh_compat_5),, \ + if [ -e $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper ]; then \ + cat $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper; \ + fi;) \ cat $(DEB_DEBCONF_HACK_SCRIPT); \ echo 'if [ -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \ echo ' debconf_set > $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper + $(if $(dh_compat_5), \ + if [ -e $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper ]; then \ + cat $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper; \ + fi;) \ + } >> $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper.new + mv $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper.new \ + $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper $(patsubst %,binary-fixup/%,$(DEB_DEBCONF_HACK_PACKAGES)) :: binary-fixup/%: debian-debconf-hack/%