Blame SOURCES/cobbler-modprobe-d.patch

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