]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Use standard ifcfg filenames, put them into an ifcfg directory.
authorWarren Togami <wtogami@redhat.com>
Mon, 27 Jul 2009 19:54:21 +0000 (15:54 -0400)
committerWarren Togami <wtogami@redhat.com>
Mon, 27 Jul 2009 19:54:21 +0000 (15:54 -0400)
modules.d/40network/write-ifcfg.sh
modules.d/99base/init

index 7da99598186cf65fc775670fccdc5c839517a4c2..4590be90e45fdcb35b1b64ad0019a8c8770e4833 100755 (executable)
@@ -8,42 +8,43 @@ udevadm settle --timeout=30
 read IFACES < /tmp/net.ifaces
 
 for netif in $IFACES ; do
+    mkdir -p /tmp/ifcfg/
     # bridge?
     unset bridge
     if [ "$netif" = "$bridgename" ]; then
         bridge=yes
     fi
     cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
-    echo "# Generated by dracut initrd" > /tmp/net.$netif.ifcfg
-    echo "DEVICE=$netif" >> /tmp/net.$netif.ifcfg
-    echo "ONBOOT=yes" >> /tmp/net.$netif.ifcfg
+    echo "# Generated by dracut initrd" > /tmp/ifcfg/ifcfg-$netif
+    echo "DEVICE=$netif" >> /tmp/ifcfg/ifcfg-$netif
+    echo "ONBOOT=yes" >> /tmp/ifcfg/ifcfg-$netif
     if [ -f /tmp/net.$netif.lease ]; then
-       echo "BOOTPROTO=dhcp" >> /tmp/net.$netif.ifcfg
+       echo "BOOTPROTO=dhcp" >> /tmp/ifcfg/ifcfg-$netif
     else
-       echo "BOOTPROTO=none" >> /tmp/net.$netif.ifcfg
+       echo "BOOTPROTO=none" >> /tmp/ifcfg/ifcfg-$netif
         # If we've booted with static ip= lines, the override file is there
        . /tmp/net.$netif.override 
-       echo "IPADDR=$ip" >> /tmp/net.$netif.ifcfg
-       echo "NETMASK=$mask" >> /tmp/net.$netif.ifcfg
-       [ -n "$gw" ] && echo "GATEWAY=$gw" >> /tmp/net.$netif.ifcfg
+       echo "IPADDR=$ip" >> /tmp/ifcfg/ifcfg-$netif
+       echo "NETMASK=$mask" >> /tmp/ifcfg/ifcfg-$netif
+       [ -n "$gw" ] && echo "GATEWAY=$gw" >> /tmp/ifcfg/ifcfg-$netif
     fi
 
     # bridge needs differente things written to ifcfg
     if [ -z "$bridge" ]; then
         # standard interface
-        echo "HWADDR=$(cat /sys/class/net/$netif/address)" >> /tmp/net.$netif.ifcfg
-        echo "TYPE=Ethernet" >> /tmp/net.$netif.ifcfg
-        echo "NAME=\"Boot Disk\"" >> /tmp/net.$netif.ifcfg
+        echo "HWADDR=$(cat /sys/class/net/$netif/address)" >> /tmp/ifcfg/ifcfg-$netif
+        echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$netif
+        echo "NAME=\"Boot Disk\"" >> /tmp/ifcfg/ifcfg-$netif
     else
         # bridge
-       echo "TYPE=Bridge" >> /tmp/net.$netif.ifcfg
-        echo "NAME=\"Boot Disk\"" >> /tmp/net.$netif.ifcfg
+       echo "TYPE=Bridge" >> /tmp/ifcfg/ifcfg-$netif
+        echo "NAME=\"Boot Disk\"" >> /tmp/ifcfg/ifcfg-$netif
         # write separate ifcfg file for the raw eth interface
-        echo "DEVICE=$ethname" >> /tmp/net.$ethname.ifcfg
-        echo "TYPE=Ethernet" >> /tmp/net.$ethname.ifcfg
-        echo "ONBOOT=yes" >> /tmp/net.$ethname.ifcfg
-        echo "HWADDR=$(cat /sys/class/net/$ethname/address)" >> /tmp/net.$ethname.ifcfg
-        echo "BRIDGE=$netif" >> /tmp/net.$ethname.ifcfg
-        echo "NAME=$ethname" >> /tmp/net.$ethname.ifcfg
+        echo "DEVICE=$ethname" >> /tmp/ifcfg/ifcfg-$ethname
+        echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$ethname
+        echo "ONBOOT=yes" >> /tmp/ifcfg/ifcfg-$ethname
+        echo "HWADDR=$(cat /sys/class/net/$ethname/address)" >> /tmp/ifcfg/ifcfg-$ethname
+        echo "BRIDGE=$netif" >> /tmp/ifcfg/ifcfg-$ethname
+        echo "NAME=$ethname" >> /tmp/ifcfg/ifcfg-$ethname
     fi
 done
index 36f1a0783151f86f637edf0d37e82c364b8e1115..485cc2da7f0ba6a9064325995890cfff6304c7a0 100755 (executable)
@@ -223,6 +223,7 @@ if getarg rdcopystate; then
     cp /tmp/* /dev/.initramfs/ >/dev/null 2>&1
 else
     cp /tmp/net.* /dev/.initramfs/ >/dev/null 2>&1
+    cp -a /tmp/ifcfg/ /dev/.initramfs/ >/dev/null 2>&1
 fi
 
 exec switch_root "$NEWROOT" "$INIT" $initargs || {