Don Russell wrote:
LuKreme wrote:
On 11-Jun-2007, at 20:49, Don Russell wrote:
I'm not very strong with procmail matching... :-(
I receive a lot of e-mail with a subject line like:
Fedora 7 Update: xorg-x11-server-1.3.0.0-8.fc7
In the body are more details (nicely consistent)
Name : xorg-x11-server
Product : Fedora 7
Version : 1.3.0.0
Release : 8.fc7
How can I extract the "Name", "Version" and "Release" information so I
can use them within procmail?
# Check the subject so we only do the expensive body checking for
those messages that match
# If you know the Subject is followed by a space in your email, leave
this as a space, if it is
# a tab, change it to a tab, or use :[ ]+ (space tab)
:0
* ^Subject: Fedora 7 Update:
{
:0
* B ?? ^Name[ ]+: \/.*
{ PACKAGE= $MATCH }
:0
* B ?? ^Version[ ]+: \/.*
{ VERSION = $MATCH }
:0
* B ?? ^Release[ ]+: \/.*
{ RELEASE = $MATCH }
}
What I want to do is:
Check if the package is installed: rpm -q <Name>
Without knowing what rpm -q returns I can't write this part, but if
it returns an exit code, then you can run the command from a recipe
and proceed from there, but you would need to know more about how rpm
works, or have it write it's out put to a file that you can then read
with procmail to compare against the email
That you.... that really helps me out.... I already have all the
messages going to a single folder, so I'll just add the "expensive body
parts" inside that....
As for rpm....
It appears rpm does not set a return code.... it has text output....
i.e. (at a command line)
rpm -q goof
package goof is not installed
rpm -q yum
yum-3.2.0-1.fc7
Well, I stand corrected:
rpm -q goof (a package name known not to be installed) sets an exit
code of 1, while the exit code is 0 when the package is installed.
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail