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

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

 



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-guide/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


[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux