diff options
author | Jasper Capel <jasper@newnewyork.nl> | 2008-12-09 16:53:09 +0100 |
---|---|---|
committer | Jasper Capel <jasper@newnewyork.nl> | 2008-12-09 16:53:09 +0100 |
commit | 4c38dee20b6097a4d8f591139ccfa7c2cd4a9c12 (patch) | |
tree | 7920cb6c330a75b6b02037799d6ffa62bd5c3db6 /snippets | |
parent | e494b126964da5d32ff5ac88a0e652ff22caf5ca (diff) | |
download | cobbler-4c38dee20b6097a4d8f591139ccfa7c2cd4a9c12.tar.gz cobbler-4c38dee20b6097a4d8f591139ccfa7c2cd4a9c12.tar.xz cobbler-4c38dee20b6097a4d8f591139ccfa7c2cd4a9c12.zip |
Hopefully fixed the post_install_network_config for scenarios where not all MAC-addresses are specified.
Diffstat (limited to 'snippets')
-rw-r--r-- | snippets/post_install_network_config | 69 |
1 files changed, 53 insertions, 16 deletions
diff --git a/snippets/post_install_network_config b/snippets/post_install_network_config index 947d64c3..3c78e36d 100644 --- a/snippets/post_install_network_config +++ b/snippets/post_install_network_config @@ -217,24 +217,61 @@ #else echo "BOOTPROTO=dhcp" >> $devfile #end if + #else if $configbymac == False + ## We'll end up here when not all physical interfaces present for + ## this system have MAC-addresses configured for them. We don't + ## support interface renaming here. - #else - ## jcapel note: I think we only have to rename the interfaces - ## I'm assuming eth0 is the first item in the list here. - ## This will fail when renaming ethX to ethY, avoid it! - ## (we can fix this later if we're staging temporary files - ## somewhere first.) - ## - ## FIXME: there's a bug in this when having both named eth, skip it -- MPD - - #set $curiname = "eth" + $str($i) - #if $iname != $curiname - sed -i "s/$curiname/$iname/" /etc/modprobe.conf - ( - grep -v "DEVICE=" /etc/sysconfig/network-scripts/ifcfg-$curiname - echo "DEVICE=$iname" - ) > /etc/sysconfig/network-scripts/cobbler/ifcfg-$iname + MAC=\$(ifconfig -a | grep $iname | awk '{ print \$5 }') + + echo "DEVICE=$iname" > $devfile + echo "HWADDR=\$MAC" >> $devfile + echo "ONBOOT=yes" >> $devfile + + #if $bonding.lower() == "slave" and $bonding_master != "" + + ## if needed setup bonding + + echo "SLAVE=yes" >> $devfile + echo "MASTER=$bonding_master" >> $devfile + ## see Red Hat bugzilla 442339 + echo "HOTPLUG=no" >> $devfile #end if + + #if $static.lower() == "true" or $bonding.lower() == "slave" + + ## for static or slave interfaces + + #if $ip != "" and $bonding.lower() != "slave" + + + ## Only configure static networking if an IP-address is + ## configured + + echo "BOOTPROTO=static" >> $devfile + echo "IPADDR=$ip" >> $devfile + #if $netmask == "" + ## Default to 255.255.255.0? + #set $netmask = "255.255.255.0" + #end if + echo "NETMASK=$netmask" >> $devfile + + #else + + ## Leave the interface unconfigured + ## we don't have enough info for static configuration + echo "BOOTPROTO=none" >> $devfile + + #end if + + #else + ## this is a DHCP interface, much less work to do + echo "BOOTPROTO=dhcp" >> $devfile + #end if + #else + # jcapel: + # If you end up here, please mail the list... This shouldn't + # happen. ;-) #end if #for $route in $static_routes |