source: config-package-dev/debconf-divert.mk @ 3aab360

Revision 3aab360, 2.4 KB checked in by Anders Kaseorg <andersk@…>, 16 years ago (diff)
Use set -e in multi-statement Makefile commands. git-svn-id: svn+ssh://svn.mit.edu/athena/trunk/debathena/debathena/config-package-dev@23197 728af825-273c-0410-89f9-f7d3b574a069
  • Property mode set to 100644
Line 
1# -*- mode: makefile; coding: utf-8 -*-
2# Copyright © 2007-2008 Anders Kaseorg <andersk@mit.edu> and
3#                       Tim Abbott <tabbott@mit.edu>
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License as
7# published by the Free Software Foundation; either version 2, or (at
8# your option) any later version.
9#
10# This program is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18# 02111-1307 USA.
19
20ifndef _cdbs_rules_debconf_divert
21_cdbs_rules_debconf_divert = 1
22
23CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), config-package-dev (>= 3.2~)
24
25DEB_DEBCONF_HACK_SCRIPT = /usr/share/config-package-dev/debconf-hack.sh
26
27DEB_DEBCONF_HACK_PACKAGES += $(foreach package,$(DEB_ALL_PACKAGES), \
28    $(if $(wildcard debian/$(package).debconf-hack),$(package)))
29
30$(patsubst %,debian-debconf-hack/%,$(DEB_DEBCONF_HACK_PACKAGES)) :: debian-debconf-hack/%:
31        set -e; \
32        { \
33            cat $(DEB_DEBCONF_HACK_SCRIPT); \
34            echo 'if [ ! -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \
35            echo '    debconf_get $(shell cut -d'       ' -f2 debian/$(cdbs_curpkg).debconf-hack) >/var/cache/$(cdbs_curpkg).debconf-save'; \
36            echo '    debconf_set <<EOF'; \
37            sed 's/$$/  true/' debian/$(cdbs_curpkg).debconf-hack; \
38            echo 'EOF'; \
39            echo 'fi'; \
40        } >> $(CURDIR)/debian/$(cdbs_curpkg).preinst.debhelper
41        set -e; \
42        { \
43            cat $(DEB_DEBCONF_HACK_SCRIPT); \
44            echo 'if [ -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \
45            echo '    debconf_set </var/cache/$(cdbs_curpkg).debconf-save'; \
46            echo '    rm -f /var/cache/$(cdbs_curpkg).debconf-save'; \
47            echo 'fi'; \
48        } >> $(CURDIR)/debian/$(cdbs_curpkg).postinst.debhelper
49        set -e; \
50        { \
51            cat $(DEB_DEBCONF_HACK_SCRIPT); \
52            echo 'if [ -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \
53            echo '    debconf_set </var/cache/$(cdbs_curpkg).debconf-save'; \
54            echo '    rm -f /var/cache/$(cdbs_curpkg).debconf-save'; \
55            echo 'fi'; \
56        } >> $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper
57
58$(patsubst %,binary-fixup/%,$(DEB_DEBCONF_HACK_PACKAGES)) :: binary-fixup/%: debian-debconf-hack/%
59
60endif
Note: See TracBrowser for help on using the repository browser.