Re: include external file in %pre section

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

 



On Friday 29 July 2005 10:21, Dick wrote:
> > Source1: included.txt
> > ...
> > 
> > %pre
> > cat > /tmp/included << @EOF
> > %include %SOURCE1
> > @EOF
> 
> Are you sure? I thought that the sources are only available at build
> phase, not at installation phase.

My mental model is that there are two kinds of "expandable" things in
spec files: macros and environment variables.  The "evaluation models"
for the two are very different.  Macros are expanded by rpmbuild
itself before any other processing occurs.  The spec file is then
split up into the familiar chunks: %pre, %build, %install, etc.  For
each chunk, rpmbuild generates a temporary file that is executed by
/bin/sh (not always true -- but true enough for this discussion).  It
is at this stage that environment variables are "expanded".

This means that if you define a custom shell environment variable in
%pre, it won't get carried over into %build or %install -- because
those are physically separate temporary shell scripts.  However,
%{SOURCE1} should be visible in all sections of the spec file
(including even such unlikely places as %description).


[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