#! /bin/bash # (c) Michael Goetze, 2011, mgoetze@mgoetze.net error=0 ; trap "error=$((error|1))" ERR # Note: Kudzu will automatically configure eth0 for DHCP if [ $FAI_ACTION != "softupdate" ] && ! ifclass DHCPC then ainsl -v /etc/sysconfig/network "^GATEWAY=$GATEWAYS_1\$" [ -n "$IPADDR" ] && cat > $target/etc/sysconfig/network-scripts/ifcfg-eth0 <<-EOF # generated by FAI DEVICE=eth0 BOOTPROTO=static ONBOOT=yes HWADDR=`ip l sh dev eth0 | tail -1 | cut -d" " -f6` IPADDR=$IPADDR NETMASK=$NETMASK EOF # Kudzu for some reason won't write eth0 into /etc/sysconfig/hwconf # from within the chroot. The following hack puts it in there # so that Kudzu doesn't overwrite our config on first boot. if [ -f $target/sbin/kudzu ]; then grep eth0 $target/etc/sysconfig/hwconf || $ROOTCMD kudzu -c NETWORK -p \ >> $target/etc/sysconfig/hwconf fi fi fcopy -iv /etc/sysconfig/network /etc/resolv.conf /etc/networks fcopy -ivr /etc/sysconfig/network-scripts exit $error