per host ip info, without editing ks.cfg

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

 



	The question of how to kickstart everything but static ip configuration
has been asked several times, and the answer has usually been that you
can't.  Here's a method that seems to be working for my situation
anyway: redhat 7.3, ks=floppy, and --url ftp://...

In ks.cfg, use:
network --device eth0 --bootproto query

This will bring up the 1st phase (loader) networking configuration
screen and allow you to enter static ip info.  When anaconda starts up
however, it doesn't remember the info just entered, and doesn't
recognize "query" as a valid option (not that you'd want to enter it
twice anyway).

	By including the following %pre section, the ip info (including
hostname, which is derived from dns) is extracted from /tmp/netinfo,
(and /etc/resolv.conf) and replaces the network configuration line in
/tmp/ks.cfg, the local copy of the kickstart file, in time for it to be
parsed by anaconda.  No editing of ks.cfg on the floppy is required,
it's unchanged and ready for the next install.

---------------------------------
%pre

get()  {
        grep $1 /tmp/netinfo |cut -d'=' -f2
}

device=`get DEVICE`
ip=`get IPADDR`
netmask=`get NETMASK`
host=`get HOSTNAME`
gateway=`get GATEWAY`
nameserver=`grep  nameserver /etc/resolv.conf`

line="network --bootproto static --device $device --ip $ip --netmask
$netmask --hostname $host --gateway $gateway --$nameserver"

ks="/tmp/ks.cfg"
sed -e "/^network/s/^network.*/$line/" $ks >${ks}.tmp && mv ${ks}.tmp
$ks
-----------------------------------
(no line breaks, of course, in 'line="network...', or that last line,
'sed -e...')


-Ed





[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