Tuesday, April 19, 2022

[SOLVED] RPM directory that shouldn't get erased on upgrade

Issue

I am trying to build a rpm package for my application. And I would like to not remove a owned directory but keep adding files to it on upgrade. I will also like to remove the directory and all it files on uninstall. How do I achieve this?


Solution

that is basic behavior or rpm packages. If you put this:

%files
/var/application

in your spec file; then the directory /var/application belongs to the rpm with everything below. When you uninstall your rpm; the directory will be completely removed.

Suppose application.1.rpm contains:

/var/application/file1
/var/application/file2

and application.2.rpm contains:

/var/application/file2
/var/application/file3

then after upgrade from application.1.rpm to application.2.rpm; the directory will contain file2 and file3. file1 will be removed because it is not anymore part of application.2.rpm.



Answered By - Chris Maes
Answer Checked By - David Goodson (WPSolving Volunteer)