RPM Spec File - %define into %pre section

Todd Zullinger tmz at pobox.com
Mon Aug 17 19:21:07 UTC 2009


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.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 542 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20090817/0b4b0f94/attachment-0001.sig>


More information about the fedora-list mailing list