Re: RPM Spec File - %define into %pre section

2009-08-17 Thread Todd Zullinger
Bruno Galindro da Costa wrote:
> I´m building a RPM package and I need to check if a user exists
> before install the package. If user exists, the script will create
> him in the system. Before I compile then, I´ve  tried to install it,
> but the following error is displayed. Is this because I´ve putted a
> %define into the %pre section? How can I define a variable that I
> %can use on the %defattr directive inside %pre section?

I don't think you can do what you want with rpm.  By the time the %pre
scriptlet is running, the %defattr in the %files section is long since
set.  You could use chgrp in %post to fix up the group ownership of
the files, which will make rpm complain if you run --verify against
this package.

There's probably a better way to handle this if you're willing and
able to change more than just this one package.  It seems to me that
needing to do this seems like a good indication that something else is
wrong.

-- 
ToddOpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~
All I really want for Christmas is Santa's list of Naughty Girls.



pgpRGqITL2Qcy.pgp
Description: PGP signature
-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

Re: RPM Spec File - %define into %pre section

2009-08-17 Thread Bruno Galindro da Costa
Ok, I´m try to do that, but the variables that are defined on the top of
spec file will be avaliable for the %post section? How can I access then on
the %post section?

*e.g:*

*%post
chgrp oracle: %{script_path}
*



2009/8/17 Todd Zullinger 

> Bruno Galindro da Costa wrote:
> > I´m building a RPM package and I need to check if a user exists
> > before install the package. If user exists, the script will create
> > him in the system. Before I compile then, I´ve  tried to install it,
> > but the following error is displayed. Is this because I´ve putted a
> > %define into the %pre section? How can I define a variable that I
> > %can use on the %defattr directive inside %pre section?
>
> I don't think you can do what you want with rpm.  By the time the %pre
> scriptlet is running, the %defattr in the %files section is long since
> set.  You could use chgrp in %post to fix up the group ownership of
> the files, which will make rpm complain if you run --verify against
> this package.
>
> There's probably a better way to handle this if you're willing and
> able to change more than just this one package.  It seems to me that
> needing to do this seems like a good indication that something else is
> wrong.
>
> --
> ToddOpenPGP -> KeyID: 0xBEAF0CE3 | URL: 
> www.pobox.com/~tmz/pgp
> ~~
> All I really want for Christmas is Santa's list of Naughty Girls.
>
>
> --
> fedora-list mailing list
> fedora-list@redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
> Guidelines:
> http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
>



-- 
Att.
Bruno Galindro da Costa
bruno.galin...@gmail.com
Florianópolis - SC
-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

Re: RPM Spec File - %define into %pre section

2009-08-17 Thread Todd Zullinger
Bruno Galindro da Costa wrote:

(Please don't top post.  Trim the quotes and reply after.)

> Ok, I´m try to do that, but the variables that are defined on the
> top of spec file will be avaliable for the %post section? How can I
> access then on the %post section?
>
> *e.g:*
>
> *%post
> chgrp oracle: %{script_path}
> *

In a case like the example above, %{script_path} will be expanded by
rpm when the %post scriptlet is run.

If you are thinking more of how to get the current oracle group for
use in %post, it might be something like this:

%post
oracle_group=$(groups oracle | awk -F : '{print $2}' |awk '{print $1}')
chmod $oracle_group %{script_path}

Still, I'd look to avoid needing to do this entirely.

-- 
ToddOpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~
Don't take life so seriously...it's not a permanent condition.
-- Noire



pgpgdHu5X9etn.pgp
Description: PGP signature
-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

Re: RPM Spec File - %define into %pre section

2009-08-17 Thread Bruno Galindro da Costa
It works! Thank you very much!

2009/8/17 Todd Zullinger 

> Bruno Galindro da Costa wrote:
>
> (Please don't top post.  Trim the quotes and reply after.)
>
> > Ok, I´m try to do that, but the variables that are defined on the
> > top of spec file will be avaliable for the %post section? How can I
> > access then on the %post section?
> >
> > *e.g:*
> >
> > *%post
> > chgrp oracle: %{script_path}
> > *
>
> In a case like the example above, %{script_path} will be expanded by
> rpm when the %post scriptlet is run.
>
> If you are thinking more of how to get the current oracle group for
> use in %post, it might be something like this:
>
> %post
> oracle_group=$(groups oracle | awk -F : '{print $2}' |awk '{print $1}')
> chmod $oracle_group %{script_path}
>
> Still, I'd look to avoid needing to do this entirely.
>
> --
> ToddOpenPGP -> KeyID: 0xBEAF0CE3 | URL: 
> www.pobox.com/~tmz/pgp
> ~~
> Don't take life so seriously...it's not a permanent condition.
>-- Noire
>
>
> --
> fedora-list mailing list
> fedora-list@redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
> Guidelines:
> http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
>



-- 
Att.
Bruno Galindro da Costa
bruno.galin...@gmail.com
Florianópolis - SC
-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

Re: RPM Spec File - %define into %pre section

2009-08-18 Thread Patrick O'Callaghan
On Mon, 2009-08-17 at 20:46 -0300, Bruno Galindro da Costa wrote:
> It works! Thank you very much!
> 
> 2009/8/17 Todd Zullinger 
[...]
> (Please don't top post.  Trim the quotes and reply after.)

Which part of the above did you not understand?

poc


-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines