more install.sh

Julian Field MailScanner at ecs.soton.ac.uk
Mon Oct 27 11:36:48 GMT 2008



Rick Cooper wrote:
>  
>
>  > -----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
> following format:
>
>
>   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
> like
>
> MODULE=`perldoc -t perllocal |grep -A 7 DBI::Shell|grep '"Module"'|sed
> 's/.*Module" //'`
> 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 
>  > building 
>  > > 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
>   
Well, yes, but that's not so much use when:
scale=7
2.10 <= 2.9
1
2.8 <= 2.9
1

Obviously 2.1 (as a number) is less than 2.9, I need it to be able to 
tell that 2.10 (as a version number two point ten) > two point nine.
> Of course you would have to make sure that MODULE|VERSION != '' and install
> as required but that is trivial
>
> Rick
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
>   

Jules

-- 
Julian Field MEng CITP CEng
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store

Need help customising MailScanner?
Contact me!
Need help fixing or optimising your systems?
Contact me!
Need help getting you started solving new requirements from your boss?
Contact me!

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the MailScanner mailing list