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

Re: Running the same code for 2 subpackages



On March 21, 2007 3:22:25 PM +0200 Erez Zilber <erezz voltaire com> wrote:
Hi,

I have a spec file that generates 2 subpackages (using the %package
directive). For both subpackages, I want to run the same code in the
%post section. Do I need to duplicate my code?

Yes.

Or can I put a function call anywhere and call it from the %post section?

No, because each scriptlet is independent.  You can have a file in the
rpm which contains the function, and have the scriptlet call that.  Or
you can have that file be the entire function, and just use it as the
interpreter (%post -n package -p file_with_scriptlet_function).  Or,
create a macro and include that macro in your scriptlet.

%define fn\
foo() {\
do_something\
}\
%nil

%post -n pkg
%fn

The syntax above may not be 100% correct, but you get the idea.

-frank


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