RPM pre/post/pre-un/post-un and behavior of $1
Panu Matilainen
pmatilai at laiskiainen.org
Mon Aug 16 09:32:13 UTC 2010
On Mon, 16 Aug 2010, Amol P wrote:
> Hi all,
> Please have a look of RPM installation output when carried out for two
> diff version one after the another. The Installed version is obtained by
> "rpm -qa | grep mypkg" to check the version which got installed after any
> rpm -i/-U comand.
>
> --------------------------------------------------------------------------------
> ----------
> #1 rpm -Uvh mypkg-2010.05.1.18.noarch.rpm
> -PRE-IN:$1=1
> -POST-IN:1=1
> -Installed Version: mypkg-2010.05.1.18.noarch
> --------------------------------------------------------------------------------
> ----------
> #2 rpm -Uvh mypkg-2010.05.2.2.noarch.rpm
> - PRE-IN:$1=2
> - POST-IN:$1=2
> - PRE-UN:$1=1
> - POST-UN:$1=1
> - Installed Version: mypkg-2010.05.2.2.noarch
> --------------------------------------------------------------------------------
> ----------
> #3 rpm -Uvh mypkg-2010.05.2.2.noarch.rpm --force
> - PRE-IN:$1=2
> - POST-IN:$1=2
> - Installed Version: mypkg-2010.05.2.2.noarch
> --------------------------------------------------------------------------------
> ----------
> #4 rpm -ivh mypkg-2010.05.1.18.noarch.rpm --force
> - PRE-IN:$1=2
> - POST-IN:$1=2
> - Installed Version: mypkg-2010.05.1.18.noarch, mypkg-2010.05.2.2.noarch
> --------------------------------------------------------------------------------
> ----------
> #5 rpm -ivh mypkg-2010.05.2.2.noarch.rpm --force
> - PRE-IN:$1=3
> - POST-IN:$1=3
> - Installed Version: mypkg-2010.05.1.18.noarch, mypkg-2010.05.2.2.noarch
> --------------------------------------------------------------------------------
> ----------
>
> In observation #4, why both versions are in RPM database. Any other way
> by which we can remove the higher version package when we are trying to
> install/update the lower version package
Because you're installing, not upgrading. Rpm permits several versions of
a single package to be installed simultaneously if you install instead of
upgrading (typically used for the kernel package).
> In observation #5, a new player comes in $1=3. Is it new feature or
> some strange.
It's basically an artifact of using --force.
> Also, how to remove the newer package & its installed stuff, when I am
> trying to install/update a LOWER version package forcefully. Is it
> possible or some tweaking required?
If you're using rpm cli to do the job, you can use --oldpackage to tell
rpm to downgrade:
[root at dhcp102 noarch]# rpm -Uvh foo-0.2-1.noarch.rpm
Preparing... ###########################################
[100%]
1:foo ###########################################
[100%]
[root at dhcp102 noarch]# rpm -q foo
foo-0.2-1.noarch
[root at dhcp102 noarch]# rpm -Uvh --oldpackage foo-0.1-1.noarch.rpm
Preparing... ###########################################
[100%]
1:foo ###########################################
[100%]
[root at dhcp102 noarch]# rpm -q foo
foo-0.1-1.noarch
The more generic answer though: use an epoch to override the normal
version comparsion, making the older package "win" the version comparison,
so regular update without special cli-switches will work.
- Panu -
More information about the Rpm-list
mailing list