fpm icon indicating copy to clipboard operation
fpm copied to clipboard

how to set multiple non-default file attrs in rpm build

Open vinceskahan opened this issue 9 years ago • 8 comments

Can you provide an example of how I can define the specific attrs on multiple files to be packaged into one rpm ? What I'm looking for is the ability to define one file with all the non-default mode/user/group settings ala

%attr (0711,root,-) /some/file/here %attr (0770,user1,group1) /some/other/file

I know a lame workaround is to do this in a postinstall scriptlet, but do you have support for specifying a set of attributes in a easy to cook up file ?

vinceskahan avatar Aug 18 '15 16:08 vinceskahan

I was looking at the code, because I'm having the same problem. When it sets the attributes in the RPM it actually sets each file defined with the --rpm-user --rpm-group. There would need to be an additional flag like --rpm-attr something along the lines of --rpm-userfile --rpm-groupfile that overrides the default ona per file basis. For the actual permissions, you can use --rpm-attr [ATTR][FILE] to accomplish that.

Something like --rpm-attr 0755/some/executable/file

ayohrling avatar Sep 11 '15 20:09 ayohrling

A working (in my case) exampple: --rpm-attr 0755,apache,apache:/var/run/samplefile (the colon is used to separate ATTR and FILE)

pmst avatar Oct 15 '15 13:10 pmst

@pmst Thanks for that example! Saved me a bunch of time. ^_^

treyka avatar Oct 20 '15 08:10 treyka

Can you use globs like you can in RPM SPEC files?

e.g. --rpm-attr 0755,apache,apache:/usr/lib/python/site-packages/my_package.egg-info/*

InfoSec812 avatar Mar 11 '16 21:03 InfoSec812

Would it be too much to ask for 'one' authoritative example of anything fpm?

Great tool but basically too bad so sad you figure it out yourself for anybody trying to use the rpm features. On Mar 11, 2016 1:25 PM, "Deven Phillips" [email protected] wrote:

Can you use globs like you can in RPM SPEC files?

e.g. --rpm-attr 0755,apache,apache:/usr/lib/python/site-packages/my_package.egg-info/*

— Reply to this email directly or view it on GitHub https://github.com/jordansissel/fpm/issues/983#issuecomment-195561146.

vinceskahan avatar Mar 11 '16 21:03 vinceskahan

I'm looking at this as well and am a bit stumped this is not really documented. I want to do this in my .fpm file:

--rpm-defattrdir 0755
--rpm-defattrfile 0644
--rpm-attr 1770,root,root:/opt/informix-client-sdk-4.50.FC9/tmp
--rpm-attr 0755,root,root:/opt/informix-client-sdk-4.50.FC9/bin/Informix.Net.Core.dll
--rpm-attr 0755,root,root:/opt/informix-client-sdk-4.50.FC9/bin/check_version
--rpm-attr 0755,root,root:/opt/informix-client-sdk-4.50.FC9/bin/chkenv

But the generated RPM file applies the default attribute regardless of my overwrites. Any tips on how to handle this?

moritzdietz avatar Feb 06 '23 15:02 moritzdietz

Ok, at least I just solved my issue. I had to put the individual attributes before the default ones. Makes sense if you think about.

moritzdietz avatar Feb 06 '23 15:02 moritzdietz

Would be nice to support it for deb packages as well. For now I use after-upgrade and after-install scripts to set file/dir permissions.

me21 avatar Nov 15 '23 12:11 me21