Is %defattr honored for automatically created parent directories of packaged files?

John Craws john.craws at
Wed Jul 13 20:33:12 UTC 2011


I'm trying to create an RPM package and ran into the following problem:


%attr(755,someuser,someuser) /opt/adirectory/sbin/myfile

I can build the rpm and install it (/opt/adirectory does not exist).
However, while /opt/adirectory/sbin/myfile will have the correct
permissions and owner, /opt/adirectory/sbin will be owned by root when
I expected it to be owned by someuser (because of the %defattr).

If I directly specify the inclusion of the /opt/adirectory/sbin
directory, then it will have the correct owner. However, I do not want
to do that as I do not want the RPM to 'own' /opt/adirectory/sbin'
because I have to create other RPMs that also have to install files to
/opt/adirectory/sbin and RPM will refuse to install them because of
conflicts (if I use the same technique).

I haven't been able to find information on how to do that. Is there a
way to do what I intend to do using only the spec file?

Thank you,

John Craws

More information about the Rpm-list mailing list