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

Pat patchu1 at yahoo.com
Wed Feb 23 02:03:11 UTC 2011


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

 


      




More information about the Kickstart-list mailing list