Tuesday, April 19, 2022

[SOLVED] rpm -e not cleaning up folders which are co-owned by many packages

Issue

Suppose we have 10 products all need to be installed under /opt/xyz.
rpm -e is not cleaning up directories on last uninstall.

The spec file is as below:

%dir
/opt/xyz/client/version/lib
/opt/xyz/client/version/bin
/opt/xyz/client/version/etc

Solution

If you specify

%dir /opt/xyz/client/version/lib

rpm -qlp doesnt list any other folders under lib or above. So to remove all the parent folders installed by this package explicitly list them in %dir folder as below

%dir
/opt/xyz
/opt/xyz/client
/opt/xyz/client/version
/opt/xyz/client/version/lib

OR in %files section specify the parent folder (this includes all the files folders under the folder)

%files
/opt/xyz

includes everything after xyz. So if you want to rpm to own install/cleanup specify in %files section. But if you want rpm own only few selective folders/files specify them in %dir section



Answered By - Mark
Answer Checked By - Senaida (WPSolving Volunteer)