file-permissionsrpmrpm-specfile-ownership

How to replace binary file during rpm upgrade without changing permissions


I need to replace the existing binary during rpm upgrade but I do not want to change the permission/ownership which is set already.

In my case, after the binary installation (not upgrade), ownership/permissions are set properly by rpm. But after the rpm installation, permissions/ownership of the file are modified by admin to allow another process to run this binary. Owner/group of the another process is different from this process. But when the rpm is upgraded it resets the permissions/ownership and another process is now not able to execute it.

Looking for a solution on how to retain the existing ownership/permissions but replace the binary only.

Any type of help/pointers are appreciated. Let me know if you have any questions.


Solution

  • Read the state of the file in %pre and restore it in %posttrans for more informations see https://fedoraproject.org/wiki/Packaging:Scriptlets#Saving_state_between_scriptlets