The -f option to hostname is very linux specific; even coreutils
hostname doesn't support it. Add a user overridable HOSTNAME variable
that, by default, sets itself to the first of `hostname -f` or `hostname`
that succeeds. With this patch, quilt mail works on Linux and Mac OS
(at least) without any further intervention, and allows others to set
HOSTNAME otherwise.
Unfortunately, because I work on a DHCP laptop behind a NAT firewall,
and have my MTA configured to pass outgoing internet email to a
smarthost that change alone isn't enough. Also, I have set the
envelope header with sendmail/postfix's -f option and added another
user overridable ENVELOPE_SENDER variable. I'm sending this patch
series with that set up.
quilt.quiltrc | 8 ++++++++
quilt/mail.in | 13 +++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
Index: quilt-HEAD/quilt/mail.in
===================================================================
--- quilt-HEAD.orig/quilt/mail.in
+++ quilt-HEAD/quilt/mail.in
@@ -7,6 +7,8 @@
# See the COPYING and AUTHORS files for more details.
: ${EDITOR:=vi}
+: ${HOSTNAME:=$(hostname -f 2>/dev/null || hostname)}
+: ${LOGNAME:=$(whoami)}
# Read in library functions
if [ "$(type -t patch_file_name)" != function ]
@@ -19,6 +21,9 @@ then
. @SCRIPTS@/patchfns
fi
+# Don't set this before quiltrc has been read in by the code above.
+: ${ENVELOPE_SENDER:[EMAIL PROTECTED]
+
options=`getopt -o o:h --long from:,to:,cc:,bcc:,subject:,send,mbox -- "$@"`
usage()
{
@@ -53,7 +58,7 @@ with a template for the introductory mes
msgid()
{
local timestamp=$(@DATE@ --utc "+%Y%m%d%H%M%S.%N")
- echo "[EMAIL PROTECTED](hostname -f)"
+ echo "[EMAIL PROTECTED]"
}
process_mail()
@@ -67,13 +72,13 @@ process_mail()
--extract-recipients Bcc \
< $tmpfile)
if [ -n "$opt_send" ]; then
- echo @MTA@ "$@"
+ echo @MTA@ -f "$ENVELOPE_SENDER" "$@"
@SCRIPTS@/edmail --charset $opt_charset \
--remove-header Bcc "$@" < $tmpfile \
- | @MTA@ "$@"
+ | @MTA@ -f "$ENVELOPE_SENDER" "$@"
else
local from_date=$(@DATE@ "+%a %b %e %H:%M:%S %Y")
- echo "From ${LOGNAME:-$(whoami)[EMAIL PROTECTED](hostname -f)
$from_date"
+ echo "From [EMAIL PROTECTED] $from_date"
@SED@ -e 's/^From />From /' $tmpfile
echo
fi
Index: quilt-HEAD/quilt.quiltrc
===================================================================
--- quilt-HEAD.orig/quilt.quiltrc
+++ quilt-HEAD/quilt.quiltrc
@@ -20,6 +20,14 @@ QUILT_PATCHES_PREFIX=yes
# sourcing this configuration file, or vi if $EDITOR wasn't set).
#EDITOR=nedit
+# Set the envelope-sender if using quilt mail behind a smarthost when
+# localhost is hidden from internet DNS by NAT (defaults to [EMAIL PROTECTED])
[EMAIL PROTECTED]
+# If hostname(1) doesn't return a fully qualified domain name, or you
+# want to set the quilt mail From header and envelope-sender (defaults
+# to `hostname -f`:
+#HOSTNAME=$(hostname -f 2>/dev/null || hostname)
+
# The following ``mail'' command filter recognizes the format we use for
# kernel patches inside SUSE. The format is as follows (slightly
# simplified; Signed-off-by and Acked-by lines optional):
--
Gary V. Vaughan ())_. [EMAIL PROTECTED],gnu.org}
Research Scientist ( '/ http://tkd.kicks-ass.net
GNU Hacker / )= http://www.gnu.org/software/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev