Re: preserving file attributes from make install in rpm spec file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Dec 13, 2007 10:20 AM, Bob Beers <bob.beers@xxxxxxxxx> wrote:
I am new to rpm building and trying to do the right thing.

I want to build an rpm from a set of files which comes
 with a Makefile install target that sets ownership
 and permissions differently for different files.

When executing make install (as root) everything is ok,
 but trying to build the rpm as non-root fails
 with "cannot change ownership of `/var/tmp/...' : Operation not permitted"

The Makefile has (simplified version)
install:
  $(INSTALL) -d $(DESTDIR)$(BINDIR)
#any group
  $(INSTALL) -m 755 file01 $(DESTDIR)$(BINDIR)
  $(INSTALL) -m 644 file02 $(DESTDIR)$(BINDIR)
#wheel group
  $(INSTALL) -m 750 -g wheel file03 $(DESTDIR)$(BINDIR)
#aaa group
  $(INSTALL) -m 750 -g aaa file04 $(DESTDIR)$(BINDIR)
#bbb group
  $(INSTALL) -m 750 -g bbb file05 $(DESTDIR)$(BINDIR)

The spec file has:

%install
make DESTDIR=%buildroot/ install

Obviously I'm overlooking something.  I am sure this is not that unusual.

BTW, and I know I should not do it, if I build the rpm as root,
 the permissions are fine, but all files are root:root.
 
What you miss is %attr markers in the %files manifest.

Add explicit
   %attr(mode,user,group)
(substituting the actual values for "mode", "user", "group" above)
for paths listed in the %files manifest.

There is also %defattr, and there's a certain art to expressing
%attr so that itscopes correctly across glob patterns, but rpm
packaging easily separates the actual {mode,user,group} used
during build from the same tuple used during install.

hth

73 de Jeff 
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux