Extracting variables from within ks.cfg, interpreted from command-line
Dan Trainor
dan at id-confirm.com
Wed Mar 15 06:59:19 UTC 2006
Stuart J. Browne wrote:
> You shouldn't need to, the /tmp/ should be the same at that point for
> the %include (It was when I was doing this).
>
> You should be able to add a simple 'read JUNK' into your %pre to pause
> it there so you can check VT2 and see if the file was created properly,
> or just cat it at that point to another of the VT's.
> ----- Original Message ----- From: "Dan Trainor" <dan at id-confirm.com>
> To: "Discussion list about Kickstart" <kickstart-list at redhat.com>
> Sent: Wednesday, March 15, 2006 12:45 PM
> Subject: Re: Extracting variables from within ks.cfg,interpreted from
> command-line
>
>
>> Chris Lumens wrote:
>>>> I'm using something similar to this, to define network arguments:
>>>>
>>>> network --device=eth0 \
>>>> --bootproto=static \
>>>> --ip=`/usr/bin/echo ${IPADDR}` \
>>>> --netmask=`/usr/bin/echo ${NMADDR}` \
>>>> --gateway=`/usr/bin/echo ${GWADDR}` \
>>>> --nameserver=`/usr/bin/echo ${NSADDR}`
>>>>
>>>> ...to no avail. I see the literal contents (IPADDR=`/usr/bin/echo )
>>>> inside my system config scripts, instead of the extracted value
>>>> being written to these files. I've even gone so far as to get rid
>>>> of my echo statement in an attempt to get it to work, as well as
>>>> just placing ${VARNAME}, to get more familiar with how Anaconda
>>>> extracts these values trying to find my mistake.
>>>>
>>>> I'm sure what I'm doing is not overly complicated - but for now, I'm
>>>> stuck. If anyone has any feedback, I'd be very eager to hear back
>>>> from you.
>>>
>>> Kickstart doesn't have any provisions for reading environment variables
>>> or capturing the output of programs like you're trying to do. However,
>>> you can do this stuff in a %pre script, as that just gets fed to the
>>> shell (or whatever you set the interpreter to). So you could write a
>>> pre script that generates the dynamic chunks and writes it to a file,
>>> then %include that file up in the command section.
>>>
>>> That should work.
>>>
>>> - Chris
>>>
>>
>> Hello again, Chris -
>>
>> I'm using %pre to write to a file called /tmp/netsettings. I'm then
>> trying to %include it from within my commands section.
>>
>> Every time, I'm given an error saying that /tmp/netsettings cannot be
>> found. I cannot verify this, or it's location, because Anaconda bombs
>> out and locks up vt2.
>>
>> I think I'm lost in chroot land. Do I need to mount a disk in %pre in
>> order to write my temp file? What would you suggest?
>>
>> Thanks!
>> -dant
>>
hi -
Alright, so, I think something wierd is going on.
I'm still seeing Anaconda bomb out saying that /tmp/netsettings does not
exist. I can verify that /tmp/netsettings does not get created.
However, I cannot figure out why.
vty3 tells me something similar to the following:
: command not founde 1:
: command not founde 3:
: command not founde 6:
: command not founde 9:
: command not founde 11:
/tmp/ks-script: line 44: syntax error: unexpected end of file
* WARNING - error code 512 encountered running a kickstart %pre%post script
...and it repeats one more time.
It's interesting because those numbers do not correspond with anything
in my kickstart script, nor do I have the phrase "founde" anywhere in my
kickstart. In fact, I can't find any references to that phrase in my
Anaconda source trees, either.
I know someone has to have done this and had it working successfully
before. I'm just looking for some insight here.
Are you guys sure I'm not just lost in a chroot jungle? Is placement of
%pre in relation to the networking directive relative to the situation?
Anything like that?
Thanks again, guys!
-dant
More information about the Kickstart-list
mailing list