0

I have a kickstart file which I want to use for machines with different numbers of network interfaces. When I have a KS file with multiple network clauses for multiple interfaces, anaconda refuses to run it on a machine with fewer network interfaces than that, because the higher-numbered interfaces are not found.

What I would like to do is have network clauses for the higher numbered network interfaces which are applied when those interfaces are present, but silently dropped if there is no such interface.

Is there a way to express that in a kickstart file?

kdt
  • 1,400
  • 3
  • 22
  • 34

2 Answers2

3

Do you run Kickstart over HTTP? You can manage your Kickstart file as a PHP script and pass it the number of Ethernet interfaces as an argument. Then, in the script you can use conditional statements to either echo the configuration or not based on this. It would like something like this:

<?php
header(“Content-type: text/plain”);
if (!isset($_GET[‘ethcount’])) $ethcount = “1”;
else $ethcount = $_GET[‘ethcount’];
?>
network --device=eth0 --bootproto=dhcp ...etc
<?
if ($ethcount == “2”) {
echo “network --device=eth1 --bootproto=dhcp ...etc”
?>

Then, when you call your Kickstart script, you specify the count.

http://host/kickstart.php?ethcount=2

Note, I've set a default value to 1 if it's not defined in the URL it would default to eth0 only.

http://host/kickstart.php

The options are limitless. I use this for the CPU architecture, distribution, the load (Gnome or headless), etc...

Aaron Copley
  • 12,525
  • 5
  • 47
  • 68
0

As you can find in the mailing list post, there is another option:

You can use a pre script to detect if is previously partitioned or not and then use something similar to:

%pre
#!/bin/sh

Discover condition

if condition;
then
    echo "part /boot --fstype ext3 --size=100 -- >> /tmp/part-include
    echo "part pv.100000 --size=1 --grow -- >>  /tmp/part-include
    echo "volgroup Merca --pesize=32768 pv.100000" >> /tmp/part-include
    echo "logvol swap --fstype swap --name=Swap --vgname=Merca --size=2047" >> /tmp/part-include
    echo "logvol  / --fstype ext4 --name=root --vgname=Merca --size=2048" >> /tmp/part-include
    echo "logvol /home --fstype ext4 --size=1000 --name=home --vgname=Merca" >> /tmp/part-include
else
    echo "part /boot --fstype ext3 --size=100 -- >> /tmp/part-include
    echo "volgroup Merca --pesize=32768 --useexisting --noformat" >> /tmp/part-include
    echo "logvol swap --fstype swap --name=Swap --vgname=Merca --size=2047 --useexisting --noformat" >> /tmp/part-include
    echo "logvol  / --fstype ext4 --name=root --vgname=Merca --size=2048 --useexisting --noformat" >> /tmp/part-include
    echo "logvol /home --fstype ext4 --size=1000 --name=home --vgname=Merca --useexisting --noformat" >> /tmp/part-include
fi

Later in the partitioning section use %include /tmp/part-include

d33tah
  • 321
  • 5
  • 15