I have to relocate a rpm and hence i have added Prefix in my spec file.
rpm.spec:
Prefix: /etc
Prefix: /usr
Prefix: /var
when i do relocation :
rpm -ivh --relocate /etc=/akshatha/test/ --relocate /usr=/akshatha/test/ --relocate /var=/akshatha/test/ (rpm_package)
etc has directories : aaa bbb ccc
usr has directories : ddd eee fff
var has directories : hhh iii jjj
so i see inside /akshatha/test/
$cd /akshatha/test/
$ ls -ltr
aaa bbb ccc ddd eee fff hhh iii jjj (and some_other_contents_which is not of rpm package)
the relocation is sucessful..very happy for that.
But when i do uninstall of that rpm :
rpm -e (rpm_package_name)
i see the contents inside the directories aaa bbb ccc ... are deleted.
but the directories does not get deleted as part of uninstall.
if i delete these folders forcefully during uninstall :
rpm takes RPM_PREFIX_INSTALL=/akshatha/test
which actually deletes the entire test folder(which also has someother contents which are not of that rpm package)
In the %files section you define what belongs to an rpm and what will be removed when the rpm will be removed.
If you put:
%files
/etc/test/*
The all files inside /etc/test
will belong to the rpm but not the test
directory. If you put
%files
/etc/test
Then the /etc/test
directory with all it's content will belong to the rpm and will also be removed upon uninstallation.