[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Macros in kickstarts...
- From: james oden tekelec com
- To: kickstart-list redhat com
- Subject: Macros in kickstarts...
- Date: Fri, 2 May 2003 09:11:15 -0400
Hi All,
We have had people ask if there was some sort of macro facility in
kickstart files
simular to the one used in rpm spec files. The answer of course is no, but
I just
had a little brainstorm that might get one there anyway.
The RPM2 library has a method called macro_expand, which expands macros in
text. It really trivial to create a macro pre-processor with this library
in perl:
use RPM2;
open(X, $ARGV[0]) || die "Could not open the thing!";
{
local $/;
$file = <X>;
}
print RPM2->expand_macro($file);
This is of course the hacked together script, but it will work. Say it is
called rpmPreprocessor, then
when your building your media that contains your kickstart files you would
just run them
through this program like:
rpmPreprocessor ks.template > ks.cfg
And then in your kickstart you could do things like:
%define some_macro something to print
.
.
.
%post
echo %{some_macro}
You might be worried about it processing the %post and %pre sections, but
there are no worries
because in the event the macro is not defined rpm expands it to the same
thing (or you could say
it does not expand it).
Anyway, I hope this is helpful to others.
Cheers...james
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]