rcooper at dwford.com
Tue Oct 21 20:46:12 IST 2008
> -----Original Message-----
> From: mailscanner-bounces at lists.mailscanner.info
> [mailto:mailscanner-bounces at lists.mailscanner.info] On
> Behalf Of Julian Field
> Sent: Tuesday, October 21, 2008 9:31 AM
> To: MailScanner discussion
> Subject: Re: more install.sh
> Mark Nienberg wrote:
> > I think on a centOS system the installer.sh is doing this
> for the perl
> > modules that conflict with the base perl:
> > check to see if the perl module is installed,
> > see that it isn't,
> > build an rpm for the module from the downloaded src,
> > attempt to install the rpm, but the install fails due to
> conflict with
> > installed perl,
> > force install only for those that absolutely need it.
> part of the
> > the core perl installation? I suspect that must not be possible or
> > Jules would have done it already.
> Not easy. You can't find where a Perl module is installed,
> just that it
> *is* installed.
Try perldoc -T perllocal. Outputs all modules that are installed in the
Mon Sep 8 12:53:02 2008: "Module" DBI::Shell
* "installed into: /usr/lib/perl5/site_perl/5.8.8"
* "LINKTYPE: dynamic"
* "VERSION: 11.95"
* "EXE_FILES: dbish"
Not hard to parse, gives location (if that is really important) and version
(where available). If you didn't want to return all modules and parse for
the ones you want then
cls;perldoc -t perllocal |grep -A 7 DBI::Shell
Would return the above but only the one module DBI::Shell. Since you are
using a shell script I suppose you would have to do a loop and something
MODULE=`perldoc -t perllocal |grep -A 7 DBI::Shell|grep '"Module"'|sed
VERSION=`perldoc -t perllocal |grep -A 7 DBI::Shell|grep 'VERSION'|sed
's/.*VERSION: //'|sed 's/"//g'`
LOCATION=`perldoc -t perllocal |grep -A 7 DBI::Shell|grep 'installed
into'|sed 's/.*into: //'|sed 's/"//g'`
Or better yet run the perldoc -t perllocal > tempfile.name
And grep tempfile.name for the information so the call to perldoc would only
be used once for speed.
> > Also, the installer builds rpms for packages that will not
> install due
> > to already installed rpms. For example, on my system it builds
> > perl-IO-stringy-2.110-1
> > and tries to install it, but discovers that
> > perl-IO-stringy-2.110-1.2.el5.rf
> > is already installed.
> > Could the installer test for already installed rpms before
> > and attempting installation of the new one?
> > In the above example it would run "rpm -q perl-IO-stringy"
> and then do
> > some sort of version checking.
> The version checking you need to do is far from trivial.
> 2.10 is greater
> than 2.9, but not in numerical or alphabetical terms. It's quite a
> tricky problem. I really don't want to open that Pandora's box! :-)
> Nice ideas though...
If you are just comparing parsed version numbers why not do the following
with the above example (scale 7 should cover the weird 0.10789 versions)
echo "scale=7;2.10 >= 2.9"|bc
Which would output 0 but
echo 'scale=7;2.10 <= 2.9' |bc
Would output 1
Of course you would have to make sure that MODULE|VERSION != '' and install
as required but that is trivial
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the MailScanner