On Wed, 2011-03-09 at 03:21 -0500, Kamil Paral wrote:
> ----- Original Message -----
> > Only root can chgrp files, and since mock doesn't allow running as
> > root,
> > 'install -g autotest' was failing. This patch moves the group
> > permission
> > adjustment into %attr in the %files section of the rpm. Anyone
> > running
> > autoqa
> > without rpm's installed will need to manually adjust the
> > permissions.
> > ---
> > Makefile | 2 +-
> > autoqa.spec | 5 ++---
> > 2 files changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 4a2134a..4153590 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -23,7 +23,7 @@ install: build
> > install autoqa $(PREFIX)/usr/bin/
> > install -d $(PREFIX)/etc/autoqa
> > [ -f $(PREFIX)/etc/autoqa/autoqa.conf ] || install -m 0644
> > autoqa.conf
> > $(PREFIX)/etc/autoqa/
> > - [ -f $(PREFIX)/etc/autoqa/fas.conf ] || install -m 0640 -g
> > autotest
> > fas.conf $(PREFIX)/etc/autoqa
> > + [ -f $(PREFIX)/etc/autoqa/fas.conf ] || install -m 0640 fas.conf
> > $(PREFIX)/etc/autoqa
>
> Can we add conditional chgrp when running as root (after installing
> that file), or is it too much hassle?
I thought about it as well, but decided against it due to laziness and
I
didn't feel up for maintaining two solutions (rpm and 'make install').
But if you have a suggestion, I'll definitely add it to the set of
patches.
I got bitten by this now. It wouldn't be a problem if it actually ran ok for 'make
install' installations. But it doesn't, autotest doesn't have permission to
read that file:
~~~~
AutoservRunError: scp -rq -P 22 "/etc/autoqa/"*
'root@aqc:"/etc/autoqa/"'
* Command:
scp -rq -P 22 "/etc/autoqa/"* 'root@aqc:"/etc/autoqa/"'
Exit status: 1
Duration: 0
stderr:
/etc/autoqa/fas.conf: Permission denied
~~~~
So my proposal is:
What about to install fas.conf as 0644 in Makefile and then change it to
%attr(0640,autoqa,autotest) in autoqa.spec?
This way it should work fine for development machines and production machines. The only
change required is in Makefile:
-[ -f $(PREFIX)/etc/autoqa/fas.conf ] || install -m 0640 fas.conf $(PREFIX)/etc/autoqa
+[ -f $(PREFIX)/etc/autoqa/fas.conf ] || install -m 0644 fas.conf $(PREFIX)/etc/autoqa