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?
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
.