Extracting variables from within ks.cfg, interpreted from command-line

Shabazian, Chip Chip.Shabazian at bankofamerica.com
Mon Mar 20 19:15:54 UTC 2006


Sounds like there are problems somewhere in the %pre that is causing it
to not execute properly.

I have had to debug those also, and just put my sleep commands in
various places until I was able to narrow down where it was failing.

Chip 

-----Original Message-----
From: kickstart-list-bounces at redhat.com
[mailto:kickstart-list-bounces at redhat.com] On Behalf Of Dan Trainor
Sent: Monday, March 20, 2006 9:29 AM
To: Discussion list about Kickstart
Subject: Re: Extracting variables from within ks.cfg, interpreted from
command-line

Dan Trainor wrote:
> Hello, all -
> 
> I'm trying to take a few command-line arguments during Anaconda's boot

> sequence for a new ISO which I am remastering, and I can't quite seem 
> to extract them into ks.cfg itself.
> 
> I'm using something similar to this to extract the values, in %pre:
> 
> if grep -i -q "ipaddr=[a-zA-Z0-9]" /proc/cmdline then
>     IPADDR=`cat /proc/cmdline | sed 's/.*ipaddr=\([^ ]*\).*/\1/'` else
>     IPADDR=1.2.3.4
> fi
> 
> I then can extract ${IPADDR} from most anywhere - except my ks.cfg.
> 
> 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.
> 
> Thanks!
> -dant
> 

Hello again, everyone -

I must be doing something wrong.  My %pre script has the exact same
layout (less the same commands) as the one provided in the example:

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/sysadmin-gui
de/s1-kickstart2-preinstallconfig.html

but my kickstart is still bombing out.

I am replying to my own post, in the hopes that others may see what I'm
doing, and might be able to provide some feedback (moreso than you all
have already posted (which I greatly appreciate, btw)).

I use an include to include a file which I generate in %pre, which is
used to establish some network settings.  When booting Anaconda, I get
a:

IOError: [Error 2] No such file or directory: '/tmp/netsettings'

I understand the error perfectly, but can't figure out why this file
cannot be found.  Perhaps I have my %pre in the wrong place, but
according to the manual, anywhere after the commands section should
suffice.

I've tried to issue sleep commands at the end of %pre hoping to catch
more of the error and to explore a bit more, but it seems that Anaconda
bombs out prior to to completing my %Pre script - which leads me to
believe that %pre is not parsed prior to the kickstart's initiation -
not in this instance.

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