Extracting variables from within ks.cfg, interpreted from command-line
Stuart J. Browne
sjbrowne at bluebottle.com
Wed Mar 15 01:58:06 UTC 2006
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
>
> _______________________________________________
> Kickstart-list mailing list
> Kickstart-list at redhat.com
> https://www.redhat.com/mailman/listinfo/kickstart-list
More information about the Kickstart-list
mailing list