how to get version of package 'x' when installing package 'y'

Jos Vos jos at xos.nl
Wed Nov 18 21:06:27 UTC 2009


On Wed, Nov 18, 2009 at 03:52:59PM -0500, Fulko Hew wrote:

> Here's my dilemma (maybe I'm taking the wrong approach)...
> 
> In the spec file for 'mypackage', I want to have a shell script as part of
> the %post
> that does something based on the version of _another_ of my (already
> installed) packages
> 
> in pseudo code:
> 
> %post
> 
> VER=`rpm -q other_package --queryformat'%{VERSION}'
> if VER > 1.2 then
>    do something
> else
>    do something different
> fi

Use %trigger scripts.  In your mypackage spec file, add:


%triggerin -- other_package > 1.2
do something

%triggerin -- other_package <= 1.2
do something different


This will execute the scripts every time other_package is installed/updated
and also when your package is installed/upgraded and other_package was
already installed.

-- 
--    Jos Vos <jos at xos.nl>
--    X/OS Experts in Open Systems BV   |   Phone: +31 20 6938364
--    Amsterdam, The Netherlands        |     Fax: +31 20 6948204


More information about the Rpm-list mailing list