While installing a rpm,if a newer version is already installed,installation halts.
How do i implement the same logic in the %postun section of the spec file ?
In the above illustration,i want users to be able to uninstall the latest upgrade only.
Edit in response to Chris Maes's comment
Yes this is a strange approach. But upgrading using rpm -Uvh <rpm-name> uninstalls the previous version .But we would like to allow the user to rollback to previous versions as well.
Suppose,there have been 3 consecutive upgrades,namely Upgrade A,B & C.
The user may want to uninstall C and go back to B or may be even A.
Using the rpm -U way,after upgrade C,we do not have a way to progressively downgrade from C to B and then to A. So we decided to go by this way and on each upgrade install,we will back up the files altered. During downgrades , we can simply replace the files of the previous upgrade.
However,we want to ensure that user follows the same order while uninstalling.
The approach I am using may be wrong. Please feel free to suggest alternatives.
