Package: metche
Severity: wishlist
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Currently metche uses mutt to send mails, but on a minimum installed
system mutt might not a feasible choice.

Attached patches add the support to use two more mailer choices, mailx
and mail-transport-agent (sendmail), both are virtual packages.

Cheers,
Kanru

- -- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk2dX8oACgkQsbdbXzZcx6KZ/gCgn2D2uZ5TBZwErTnb9/pW+vqK
5rAAnjjViqcJnaDgwFFMxElL8mg5yb8r
=WSDh
-----END PGP SIGNATURE-----
--- a/metche
+++ b/metche
@@ -73,15 +73,34 @@
     fi
 }
 
+add_header() {
+    local subject="$1";
+    echo "Subject: $subject";
+    echo "To: $EMAIL_ADDRESS";
+    echo
+    cat;
+}
+
+_mail() {
+    local subject="$1";
+    if which mail > /dev/null ; then
+        LC_ALL="$LOCALE" mail -s "$subject" "$EMAIL_ADDRESS"
+    elif [ -x /usr/sbin/sendmail ]; then
+        LC_ALL="$LOCALE" add_header "$subject"|/usr/sbin/sendmail 
"$EMAIL_ADDRESS"
+    elif which mutt > /dev/null ; then
+        LC_ALL="$LOCALE" mutt -s "$subject" "$EMAIL_ADDRESS"
+    fi
+}
+
 email() {
     debug "* email $@ to $EMAIL_ADDRESS"
     local subject="`current_system` - $_MAIL_SUBJECT : $1"
     if [ $ENCRYPT_EMAIL = "yes" ]; then
         LC_ALL="$LOCALE" gpg --batch --armor --encrypt \
                              --recipient "$EMAIL_ADDRESS" |
-            LC_ALL="$LOCALE" mutt -s "$subject" "$EMAIL_ADDRESS"
+            LC_ALL="$LOCALE" _mail "$subject"
     else
-        LC_ALL="$LOCALE" mutt -s "$subject" "$EMAIL_ADDRESS"
+        LC_ALL="$LOCALE" _mail "$subject"
     fi
 }
 
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@
 
 Package: metche
 Architecture: all
-Depends: ${misc:Depends}, mutt, bzip2, ucf (>= 0.28)
+Depends: ${misc:Depends}, mailx|mail-transport-agent|mutt, bzip2, ucf (>= 0.28)
 Recommends: apt-show-versions, gnupg
 Suggests: util-vserver
 Description: configuration monitor to ease collective administration

Reply via email to