Search code examples
linuxcentosrpmrhelrpmbuild

How to prevent parallel installation of multiple version of an RPM?


I'm creating an RPM file (with rpmbuild). Currently it is possible to install several versions of the RPM in parallel (apparently RPM doesn't prevent this), but this causes problems because my %pre and %post scripts create and delete some files, so multiple parallel installations will conflict with each other.

Is there a way to prevent such parallel installation when building an RPM?

The package is intended to work on CentOS (RHEL) 6.


Solution

  • Write %pre and %post scripts that can handle this (they are given an argument which indicates how many versions of the package will be installed when the transaction is finished).

    Alternatively, you could try to conflict with all older versions of your own package. That might work.