1 |
Neil Bothwick wrote: |
2 |
> On Fri, 26 May 2006 12:48:47 +0200, Alexander Skwar wrote: |
3 |
> |
4 |
>> I'd like portage to use /usr/sbin/sendmail (and thus ssmtp, nbsmtp |
5 |
>> or what not) to send out mails, instead of having it try to connect |
6 |
>> to some SMTP server. |
7 |
> |
8 |
> You can use PORTAGE_ELOG_COMMAND to call any command with the log |
9 |
> information. |
10 |
|
11 |
# PORTAGE_ELOG_COMMAND: only used with the "custom" logging module. Specifies a command |
12 |
# to process log messages. Two variables are expanded: |
13 |
# ${PACKAGE} - expands to the cpv entry of the processed |
14 |
# package (see $PVR in ebuild(5)) |
15 |
# ${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}'" |
16 |
#PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" |
17 |
|
18 |
Okay. |
19 |
|
20 |
I've now got: |
21 |
|
22 |
PORTAGE_ELOG_COMMAND="/usr/local/bin/portage-elog-command.sh to@×××××××.net from@×××××××.com '\${PACKAGE}' '\${LOGFILE}'" |
23 |
|
24 |
- "to@×××××××.net" is to be replaced with the recipient address |
25 |
-> Matches recipient address from PORTAGE_ELOG_MAILURI |
26 |
- "from@×××××××.com" is to be replaced with the sender address |
27 |
-> Matches PORTAGE_ELOG_MAILFROM |
28 |
|
29 |
/usr/local/bin/portage-elog-command.sh: |
30 |
#! /bin/sh |
31 |
|
32 |
# Recipient address |
33 |
to="$1" |
34 |
# Sender address |
35 |
from="$2" |
36 |
# ${PACKAGE} - expands to the cpv entry of the processed |
37 |
# package (see $PVR in ebuild(5)) |
38 |
pvr="$3" |
39 |
# ${LOGFILE} - absolute path to the logfile - This will |
40 |
# make up the e-mail body |
41 |
log_file="$4" |
42 |
|
43 |
# Name of the host from which this mail is sent |
44 |
hostname=`hostname -f` |
45 |
# Sender "full name" |
46 |
from_fullname="Portage Log Message" |
47 |
|
48 |
( printf "From: %s (%s)\nTo: %s\nSubject: [portage] ebuild log for %s on %s\n\n" \ |
49 |
"$from" "$from_fullname" "$to" "$pvr" "$hostname" |
50 |
cat "$log_file" |
51 |
) | sendmail -bm "$to" |
52 |
|
53 |
Alexander Skwar |
54 |
-- |
55 |
"I keep seeing spots in front of my eyes." |
56 |
"Did you ever see a doctor?" |
57 |
"No, just spots." |
58 |
-- |
59 |
gentoo-user@g.o mailing list |