Blame SOURCES/cobbler-modprobe-d.patch

1330ca
--- a/snippets/post_install_network_config	2013-11-11 10:46:45.464341394 +0100
1330ca
+++ b/snippets/post_install_network_config	2013-11-12 12:13:34.578812084 +0100
1330ca
@@ -43,9 +43,13 @@
1330ca
     ## setup bonding if we have to
1330ca
     ## if using bonding, must have an /ect/modpobe.conf file
1330ca
     #if $numbondingdevs > 0
1330ca
-touch "/etc/modprobe.conf"
1330ca
-if [ -f "/etc/modprobe.conf" ]; then
1330ca
-    echo "options bonding max_bonds=$numbondingdevs" >> /etc/modprobe.conf
1330ca
+MODPROBE_CONF="/etc/modprobe.conf"
1330ca
+if [ -d "/etc/modprobe.d" ]; then
1330ca
+     MODPROBE_CONF="/etc/modprobe.d/post_install_network_config.conf"
1330ca
+fi
1330ca
+touch "\$MODPROBE_CONF"
1330ca
+if [ -f "\$MODPROBE_CONF" ]; then
1330ca
+    echo "options bonding max_bonds=$numbondingdevs" >> \$MODPROBE_CONF
1330ca
 fi 
1330ca
     #end if
1330ca
     ## =============================================================================
1330ca
@@ -134,13 +138,13 @@
1330ca
         ## if this is a bonded interface, configure it in modprobe.conf
1330ca
         #if $bonding.lower() == "master"
1330ca
             #if $osversion == "rhel4"
1330ca
-if [ -f "/etc/modprobe.conf" ]; then
1330ca
-    echo "install $iname /sbin/modprobe bonding -o $iname $bonding_opts" >> /etc/modprobe.conf.cobbler
1330ca
+if [ -f "\$MODPROBE_CONF" ]; then
1330ca
+    echo "install $iname /sbin/modprobe bonding -o $iname $bonding_opts" >> \$MODPROBE_CONF.cobbler
1330ca
 fi
1330ca
             #else
1330ca
             ## Add required entry to modprobe.conf
1330ca
-if [ -f "/etc/modprobe.conf" ]; then
1330ca
-    echo "alias $iname bonding" >> /etc/modprobe.conf.cobbler
1330ca
+if [ -f "\$MODPROBE_CONF" ]; then
1330ca
+    echo "alias $iname bonding" >> \$MODPROBE_CONF.cobbler
1330ca
 fi
1330ca
             #end if
1330ca
         #end if
1330ca
@@ -150,11 +154,11 @@
1330ca
 IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//')
1330ca
             ## Rename this interface in modprobe.conf
1330ca
             ## FIXME: if both interfaces startwith eth this is wrong
1330ca
-if [ -f "/etc/modprobe.conf" ] && [ \$IFNAME ]; then
1330ca
-    grep \$IFNAME /etc/modprobe.conf | sed "s/\$IFNAME/$iname/" >> /etc/modprobe.conf.cobbler
1330ca
-    grep -v \$IFNAME /etc/modprobe.conf >> /etc/modprobe.conf.new
1330ca
-    rm -f /etc/modprobe.conf
1330ca
-    mv /etc/modprobe.conf.new /etc/modprobe.conf
1330ca
+if [ -f "\$MODPROBE_CONF" ] && [ \$IFNAME ]; then
1330ca
+    grep \$IFNAME \$MODPROBE_CONF | sed "s/\$IFNAME/$iname/" >> \$MODPROBE_CONF.cobbler
1330ca
+    grep -v \$IFNAME \$MODPROBE_CONF >> \$MODPROBE_CONF.new
1330ca
+    rm -f \$MODPROBE_CONF
1330ca
+    mv \$MODPROBE_CONF.new \$MODPROBE_CONF
1330ca
 fi
1330ca
 echo "DEVICE=$iname" > $devfile
1330ca
 echo "HWADDR=$mac" >> $devfile
1330ca
@@ -348,9 +352,9 @@
1330ca
 rm -f /etc/sysconfig/network-scripts/ifcfg-*
1330ca
 mv /etc/sysconfig/network-scripts/cobbler/* /etc/sysconfig/network-scripts/
1330ca
 rm -r /etc/sysconfig/network-scripts/cobbler
1330ca
-if [ -f "/etc/modprobe.conf" ]; then
1330ca
-cat /etc/modprobe.conf.cobbler >> /etc/modprobe.conf
1330ca
-rm -f /etc/modprobe.conf.cobbler
1330ca
+if [ -f "\$MODPROBE_CONF" ]; then
1330ca
+cat \$MODPROBE_CONF.cobbler >> \$MODPROBE_CONF
1330ca
+rm -f \$MODPROBE_CONF.cobbler
1330ca
 fi
1330ca
 #end if
1330ca
 # End post_install_network_config generated code