Friday, April 8, 2022

[SOLVED] Way to retrieve previous installed version in SPEC file

Issue

maybe this is a dumb question but I searched and didn't found anything. Is there any elegant way inside a SPEC definition file to retrieve the previous installed version on the local machine of the same package defined in the SPEC using maybe some variable?


Solution

Not directly, but your %pre scriptlet will be called with 2 as the first parameter if it is an upgrade. You can then do anything you want with that information, like parse the existing README or even run /path/to/your/tool --version and parse it. Or maybe you have a hidden file /path/to/your/tool/.version to make your script even simpler.

More info about scriptlets here.



Answered By - Aaron D. Marasco
Answer Checked By - Mary Flores (WPSolving Volunteer)