Creating an RPM that installs the capabilities of POSIX files

How to make an RPM that installs the capabilities of a POSIX file? If I try to make rpmbuild as a non-root user, then I get an error when my make install installs make setcap , but if I do not run setcap , how can rpmbuild copy the features? It seems that there is no way to install features from the RPM specification file .

+5
source share
1 answer

To configure the features, there is a macro spec file, %caps ; for some reason this seems to be mostly described in the release notes and changes, so it took me a while to find it.

It is used in this file:

 %caps(cap_net_admin=pe) %{_sbindir}/foobar 

To use make install to use setcap only when calling root, you can do something like this:

 @if test `id -u` -eq 0; then \ setcap cap_net_admin=pe $(DEST_SBINDIR)/foobar ; \ fi 
+7
source

Source: https://habr.com/ru/post/1206751/


All Articles