Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I deliver an application via an RPM.

This application delivers various directories and files.
E.g. under /opt/internal/com
a file structure is being copied.

I was expecting that on rpm -e all the file structure delivered under /opt/internal/com will be removed.
But it does not.
There are directories in the file structure that are non-empty.

Is this the reason? But these (non-empty) directories were created by the RPM installation. So I would expect that they would be "owned" by RPM and removed automatically.

Is this wrong? Am I supposed to remove them manually?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

RPM won't delete any files it doesn't know about, so if new files have been created in a directory that are not part of a package, RPM won't remove them, or the directories.

It will delete the directories if they are empty and it knows about them. It depends how the spec file was written.

share|improve this answer
    
Will it delete directories that are NOT empty and DOES know about them? (the rpm delivered them) –  Jim Apr 6 '12 at 11:05
    
It depends how the spec file was written. Do you mean I should have removed them in a %postun section? –  Jim Apr 6 '12 at 11:11
1  
Jim, James is saying that it wont remove directories that are non-empty because they contain files it is not aware of. If you feel that you need to remove these directories during uninstall a %postun is appropriate, but know that this is how most RPMs work. –  Kyle Smith Apr 6 '12 at 11:14
    
@Jim You could use a %postun to rm -rf the directories, but ordinarily RPM doesn't do this because it's not safe to do so. You might lose data that you didn't intend to just because you removed a package (e.g. config file modifications). –  James O'Gorman Apr 6 '12 at 11:28
    
So basically if my rpm spec has in the %files section the hierarchy /opt/internal/com and it delivers that hierarchy, on uninstall it will nor remove everything under com if there are other files dirs even if it delivered them? It delivers them recursively from /opt/internal/com but knows only about /opt/internal/com and not the containing files/folders? –  Jim Apr 6 '12 at 11:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.