Issue
I have created an RPM for a piece of software my team is building. The installation works great, but I'm adding in logic to make the software uninstall and restore the system to a working state.
As part of the install, I have to place a configuration file on the file system. However, when I uninstall the RPM, this file is left in the directory, which causes the service to function incorrectly once our package is uninstalled.
.SPEC file:
%files
...
%attr(640, tomcat, tomcat) /var/lib/owf/lib/OWFsecurityContext.xml
...
Install log:
cat Install.log | grep "OWFsecurityContext"
...
D: fini 100640 1 ( 498, 501) 2336 /var/lib/owf/lib/OWFsecurityContext.xml;53a41ad5
...
Files owned by RPM:
$ rpm -ql OurToolName | grep "OWFsecurityContext"
/var/lib/owf/lib/OWFsecurityContext.xml
Uninstall Log
$ cat Remove.log | grep "OWFsecurityContext"
D: fini 100640 1 ( 498, 501) 2336 /var/lib/owf/lib/OWFsecurityContext.xml skip
Why is RPM "skip"ing this file? Is there a way (besides just forcing a remove in the %postun section) to tell RPM to remove this file, just like all of the other files it owns?
EDIT:
After @EtanReisner 's comments, it appears that the file is owned by two packages: the package which I created in this question (by explicit file reference in the %files
section, and by the OWF install RPM, which owns the entire directory in which the file lives.
Given that the file ends up being owned by two packages, is there a way to explicitly tell RPM to remove it regardless of its status besides removing it by force in the %postun
scriptlet?
Solution
I'm not aware of any way to get RPM to ignore competing ownership and remove the file anyway like you are trying to do (and the bit of code digging I did the other day to figure out why RPM would be skipping the file didn't present anything along those lines either, though I wasn't looking for that at the time).
I believe entire directory ownership is generally discouraged for this sort of reason.
Answered By - Etan Reisner Answer Checked By - Robin (WPSolving Admin)