Neil Bothwick wrote:
On Fri, 26 May 2006 12:48:47 +0200, Alexander Skwar wrote:

I'd like portage to use /usr/sbin/sendmail (and thus ssmtp, nbsmtp
or what not) to send out mails, instead of having it try to connect
to some SMTP server.

You can use PORTAGE_ELOG_COMMAND to call any command with the log
information.

# PORTAGE_ELOG_COMMAND: only used with the "custom" logging module. Specifies a 
command
#                      to process log messages. Two variables are expanded:
#                          ${PACKAGE} - expands to the cpv entry of the 
processed
#                                       package (see $PVR in ebuild(5))
#                          ${LOGFILE} - absolute path to the logfile #                    
                           Both variables have to be quoted with single quotes 
#PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'"
#PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'"

Okay.

I've now got:

PORTAGE_ELOG_COMMAND="/usr/local/bin/portage-elog-command.sh [EMAIL PROTECTED] 
[EMAIL PROTECTED] '\${PACKAGE}' '\${LOGFILE}'"

- "[EMAIL PROTECTED]" is to be replaced with the recipient address
        -> Matches recipient address from PORTAGE_ELOG_MAILURI
- "[EMAIL PROTECTED]" is to be replaced with the sender address
        -> Matches PORTAGE_ELOG_MAILFROM

/usr/local/bin/portage-elog-command.sh:
#! /bin/sh

# Recipient address
to="$1"
# Sender address
from="$2"
# ${PACKAGE} - expands to the cpv entry of the processed
# package (see $PVR in ebuild(5))
pvr="$3"
# ${LOGFILE} - absolute path to the logfile - This will
# make up the e-mail body
log_file="$4"

# Name of the host from which this mail is sent
hostname=`hostname -f`
# Sender "full name"
from_fullname="Portage Log Message"

( printf "From: %s (%s)\nTo: %s\nSubject: [portage] ebuild log for %s on 
%s\n\n" \
        "$from" "$from_fullname" "$to" "$pvr" "$hostname"
  cat "$log_file"
) | sendmail -bm "$to"

Alexander Skwar
--
        "I keep seeing spots in front of my eyes."
        "Did you ever see a doctor?"
        "No, just spots."
--
gentoo-user@gentoo.org mailing list

Reply via email to