• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 540
  • Last Modified:

RPM %defattr not working

I'm installing an RPM package with a package.spec that tries to use the %defattr to set permissions and ownership for all files.  This is from package.spec:

%files
%defattr(0755,someId,user)
/base/runtime/standalone/listener.jar
/base/runtime/standalone/service.jar
/base/runtime/standalone/snap.jar

The rpm installation is done with scsudo like this:

scsudo root -i --prefix /home/userId test-5-1.0.noarch.rpm

The files get created correctly, but the owner/group is root/root.

Does anyone understand what might be wrong here?
0
jkavx
Asked:
jkavx
  • 4
  • 3
1 Solution
 
PapertripCommented:
Do the user and group listed in %defattr exist on the system?
0
 
jkavxAuthor Commented:
Yes.
0
 
jkavxAuthor Commented:
The problem is that files are being set with the correct attributes but directories are not.  When I dirlled down I found that the 3 .jar files have the desired permissions, owner, group.  So let me change the question somewhat.  How do you list directores in the %files section.  If I do this:
%files
%defattr(0755,someId,user)
/base/runtime
/base/runtime/standalone
/base/runtime/standalone/listener.jar
/base/runtime/standalone/service.jar
/base/runtime/standalone/snap.jar

rpmbuild fails after warning that files are listed twice.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
PapertripCommented:
try adding dir permissions at the end

%defattr(0755,someId,user,0775)

Open in new window

0
 
jkavxAuthor Commented:
No.  It doesn't work.  I'm finding I can set the %defattr, list all directories, and then use %attr for each listed file so that dirs can have one permission and files another.  
0
 
jkavxAuthor Commented:
Found an approach that works.
0
 
PapertripCommented:
Ah good call, that makes sense.

Good job!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now