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.
Because I am behind a NAT firewall, hostname cannot return an externally
visible fqdn for my machines. Similarly, my MTA's default choice for the
envelope sender is not an externally visible domain, so mail is rejected
by the recipient MTA when the reverse lookup fails. This patch also adds
an MTA_ARGS option that the user can set to give a suitable envelope
sender value to the MTA to work around this problem.
quilt.quiltrc | 8 ++++++++
quilt/mail.in | 10 ++++++----
2 files changed, 14 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 ]
@@ -52,7 +54,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()
@@ -66,13 +68,13 @@ process_mail()
--extract-recipients Bcc \
< $tmpfile)
if [ -n "$opt_send" ]; then
- echo @MTA@ "$@"
+ echo @MTA@ $MTA_ARGS "$@"
@SCRIPTS@/edmail --charset $opt_charset \
--remove-header Bcc "$@" < $tmpfile \
- | @MTA@ "$@"
+ | @MTA@ $MTA_ARGS "$@"
else
local from_date=$(@DATE@ "+%a %b %e %H:%M:%S %Y")
- echo "From ${LOGNAME:-$(whoami)[EMAIL PROTECTED](hostname -f)
$from_date"
+ echo "From ${LOGNAME:-$(whoami)[EMAIL PROTECTED]:-(hostname
-f)} $from_date"
sed -e 's/^From />From /' $tmpfile
echo
fi
Index: quilt-HEAD/quilt.quiltrc
===================================================================
--- quilt-HEAD.orig/quilt.quiltrc
+++ quilt-HEAD/quilt.quiltrc
@@ -22,6 +22,14 @@ QUILT_PATCHES_PREFIX=yes
# sourcing this configuration file, or vi if $EDITOR wasn't set).
#EDITOR=nedit
+# Use this if hostname(1) doesn't return a fully qualified domain name,
+# or if the value it returns is not an externally visible domain:
+#HOSTNAME=$(hostname -f 2>/dev/null || hostname)
+
+# Use this to set the envelope sender if you use a smarthost behind NAT
+# for example.
+#MTA_ARGS="-f [EMAIL PROTECTED]"
+
# 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