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

Mats Karlsson <[email protected]>
Newsgroups gmane.linux.redhat.kickstart.general
Message-ID <[email protected]>
On Wed, Feb 23, 2011 at 03:03, Pat <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.