Hi,
we have many hosts which send apt-listchanges reports via mail.
Since all these mails are fed into our ticketsystem, it would be very nice to
configure the subject that the mail gets attached to the right ticket automatically.
This patch does exactly this:
---
apt-listchanges.py | 10 +++++++++-
debian/config | 2 ++
debian/postinst | 3 +++
debian/templates | 7 +++++++
4 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/apt-listchanges.py b/apt-listchanges.py
index e8a195f..a28a02e 100755
--- a/apt-listchanges.py
+++ b/apt-listchanges.py
@@ -213,10 +213,18 @@ def main():
hostname = commands.getoutput('hostname')
if config.email_address and changes:
- subject = _("apt-listchanges: changelogs for %s") % hostname
+ if config.email_subject:
+ subject = config.email_subject
+ else:
+ subject = _("apt-listchanges: changelogs for %s") % hostname
apt_listchanges.mail_changes(config.email_address, changes, subject)
if config.email_address and news:
+ if config.email_subject:
+ subject = config.email_subject
+ else:
+ subject = _("apt-listchanges: changelogs for %s") % hostname
+
subject = _("apt-listchanges: news for %s") % hostname
apt_listchanges.mail_changes(config.email_address, news, subject)
diff --git a/debian/config b/debian/config
index 0a53b15..11069fd 100644
--- a/debian/config
+++ b/debian/config
@@ -8,6 +8,8 @@ set -e
db_input medium apt-listchanges/frontend || true
db_input low apt-listchanges/save-seen || true
db_input low apt-listchanges/email-address || true
+db_input low apt-listchanges/email-subject || true
+
if [ "$1" = "configure" ]; then
if [ -n "$2" ] && dpkg --compare-versions "$2" le 2.51; then
diff --git a/debian/postinst b/debian/postinst
index c974660..e09e160 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -16,6 +16,9 @@ then
db_get apt-listchanges/email-address
echo "email_address=$RET" >> $PREFERENCES.new
+ db_get apt-listchanges/email-subject
+ echo "email_subject=$RET" >> $PREFERENCES.new
+
db_get apt-listchanges/confirm
if [ "$RET" = "true" ]; then
echo "confirm=1" >> $PREFERENCES.new
diff --git a/debian/templates b/debian/templates
index cc4eeaa..87d6c18 100644
--- a/debian/templates
+++ b/debian/templates
@@ -36,6 +36,13 @@ _Description: E-mail address(es) which will receive changes:
Multiple addresses may be specified, delimited by commas. Leaving this
field empty disables mail notifications.
+Template: apt-listchanges/email-subject
+Type: string
+Default:
+_Description: E-mail subject :
+ Optionally, apt-listchanges can e-mail a copy of displayed changes
+ with the specified subject
+
Template: apt-listchanges/confirm
Type: boolean
Default: false
--
1.7.2.5