Topic: How to perform operation in post section of rpm spec when reinstalling

I have a use case where I want to execute a particular command in the post section of rpm spec only when same version of rpm is already installed. Rpm will be invoked with following option:

rpm -Uvh --replacefiles --replacepkgs rpm_file_name

Condition if [ "$1" = "2" ]; is not useful here because it becomes true for upgrades also.

How can a reinstall case be detected in spec?

Re: How to perform operation in post section of rpm spec when reinstalling

Sorry, I don't think this is possible.

Probably out-of-topic here


P.S. and I don't understand the need. Explain what is the goal/issue, not how you are trying to do it.

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi