1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#! /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
|