How to detect the number of network adapters installed from kickstart file for network config?

Mats Karlsson mats.o.karlsson at gmail.com
Wed Feb 23 06:29:50 UTC 2011


On Wed, Feb 23, 2011 at 03:03, Pat <patchu1 at yahoo.com> wrote:
> On Feb 19, 2011, at 6:57 PM, peter Sjoberg wrote:
>> Well, dunno about works but a simpler version at least
>> Task: if eth1 exist - configure it
>> Solution:
>>
>> #Top part:
>> #Always config eth0
>> network --device eth0 --bootproto dhcp
>> %include /tmp/optionalnetwork.inc
>>
>> %pre
>> #make sure the file is there to not cause any errors
>> touch /tmp/optionalnetwork.inc
>>
>> /sbin/ifconfig eth1 &>/dev/null && \
>>  echo "network --device eth1 --onboot no --bootproto dhcp"\
>>> /tmp/optionalnetwork.inc
>>
>> Or if ksbootenv ifconfig is different and doesn't fail if not found
>>
>> ifconfig -a|grep ^eth1 &>/dev/null && \
>>  echo "network --device eth1 --onboot no --bootproto dhcp"\
>>> /tmp/optionalnetwork.inc
>
>
> Thanks for all the replies and apologies for the non-threaded reply as I had subscribed to the digest version. I went with the solution above from Peter since it was simple and addressed my main need. I had to make one small correction, /sbin/ifconfig did not exist in the kickstart boot environment, it was actually at /usr/bin/ifconfig. So I removed the /sbin/ from the call to ifconfig after which it worked fine.
>
> Cheers,
> Pat


Nice with feedback.

And I think that Pete's solution was KISS and I love that design regime.

/Mats

/Mats




More information about the Kickstart-list mailing list