From 999ee603379f337cb3282b05517648eda1dbf1b7 Mon Sep 17 00:00:00 2001 From: Julien Valroff Date: Sun, 29 Aug 2010 18:30:34 +0200 Subject: Use ucf for conffile --- debian/changelog | 3 ++- debian/control | 2 +- debian/mailgraph.postinst | 25 ++++++++++++++++--------- debian/mailgraph.postrm | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 debian/mailgraph.postrm (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 52dd4ec..cc82c0e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,8 +6,9 @@ mailgraph (1.14-4) unstable; urgency=low + de - thanks to Martin Eberhard Schauer (Closes: #593570) + it - thanks to Luca Monducci (Closes: #593719) * Add versionned pre-dependency on debconf + * Use ucf to deal with conffile (thanks to Matthijs Möhlmann) - -- Julien Valroff Sun, 29 Aug 2010 17:33:35 +0200 + -- Julien Valroff Sun, 29 Aug 2010 18:29:55 +0200 mailgraph (1.14-3) unstable; urgency=low diff --git a/debian/control b/debian/control index 22f6f21..100024d 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Homepage: http://mailgraph.schweikert.ch Package: mailgraph Architecture: all -Depends: ${misc:Depends}, libfile-tail-perl, librrds-perl +Depends: ${misc:Depends}, libfile-tail-perl, librrds-perl, ucf (>= 0.28) Pre-Depends: debconf (>= 0.5) | debconf-2.0 Recommends: httpd | apache2, exim4 | postfix | sendmail | mail-transport-agent Description: RRDtool frontend for Mail statistics diff --git a/debian/mailgraph.postinst b/debian/mailgraph.postinst index 4dea08d..3af0c30 100644 --- a/debian/mailgraph.postinst +++ b/debian/mailgraph.postinst @@ -32,15 +32,22 @@ case "$1" in db_get mailgraph/ignore_localhost IGNORE_LOCALHOST=$RET - if [ -w $DF ]; then - TEMPFILE=`mktemp` || exit 1 - sed $DF -e "s,^ *BOOT_START=.*,BOOT_START=$BOOT_START," \ - -e "s,^ *MAIL_LOG=.*,MAIL_LOG=$MAIL_LOG," \ - -e "s,^ *IGNORE_LOCALHOST=.*,IGNORE_LOCALHOST=$IGNORE_LOCALHOST," \ - > $TEMPFILE - mv -f $TEMPFILE $DF - chmod 644 $DF - fi + db_stop + + TEMPFILE=`mktemp` + cat << _eof > $TEMPFILE + # Should Mailgraph start on boot + BOOT_START=$BOOT_START + + # Logfile used by mailgraph + MAIL_LOG=$MAIL_LOG + + # Ignore mail to/from localhost + IGNORE_LOCALHOST=$IGNORE_LOCALHOST + _eof + + ucf $TEMPFILE /etc/default/mailgraph + rm -f $TEMPFILE ;; diff --git a/debian/mailgraph.postrm b/debian/mailgraph.postrm new file mode 100644 index 0000000..7b631d4 --- /dev/null +++ b/debian/mailgraph.postrm @@ -0,0 +1,38 @@ +#! /bin/sh +# postrm script for mailgraph +# +# see: dh_installdeb(1) + +set -e + +# This script is called twice during the removal of the package; once +# after the removal of the package's files from the system, and as +# the final step in the removal of this package, after the package's +# conffiles have been removed. + +case "$1" in + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + purge) + for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do + rm -f /etc/default/mailgraph$ext + done + + rm -f /etc/default/mailgraph + + if which ucf >/dev/null; then + ucf --purge /etc/default/mailgraph + fi + if which ucfr >/dev/null; then + ucfr --purge mailgraph /etc/default/mailgraph + fi + + ;; + + *) echo "$0: didn't understand being called with \`$1'" 1>&2 + exit 0;; +esac + +exit 0 + -- cgit v1.2.3