]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Generate correct ifcfg file for vlan= option.
authorRadek Vykydal <rvykydal@redhat.com>
Wed, 31 Jul 2013 13:18:20 +0000 (15:18 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 31 Jul 2013 13:47:33 +0000 (15:47 +0200)
modules.d/45ifcfg/write-ifcfg.sh

index 2e78c49d2713c5ab4330e9c7ce6e5d9a16c95627..dcb2aefa811fbad8e1ba85dcfdcfa4d160f8f5ad 100755 (executable)
@@ -9,6 +9,10 @@ if [ -e /tmp/bridge.info ]; then
     . /tmp/bridge.info
 fi
 
+if [ -e /tmp/vlan.info ]; then
+    . /tmp/vlan.info
+fi
+
 mkdir -m 0755 -p /tmp/ifcfg/
 mkdir -m 0755 -p /tmp/ifcfg-leases/
 
@@ -103,6 +107,9 @@ for netup in /tmp/net.*.did-setup ; do
     # $netif can't be bridge and bond at the same time
         bond=yes
     fi
+    if [ "$netif" = "$vlanname" ]; then
+        vlan=yes
+    fi
     cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
     {
         echo "# Generated by dracut initrd"
@@ -149,7 +156,7 @@ for netup in /tmp/net.*.did-setup ; do
     } > /tmp/ifcfg/ifcfg-$netif
 
     # bridge needs different things written to ifcfg
-    if [ -z "$bridge" ] && [ -z "$bond" ]; then
+    if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
         # standard interface
         {
             if [ -n "$macaddr" ]; then
@@ -164,6 +171,15 @@ for netup in /tmp/net.*.did-setup ; do
         } >> /tmp/ifcfg/ifcfg-$netif
     fi
 
+    if [ -n "$vlan" ] ; then
+        {
+            echo "TYPE=Vlan"
+            echo "NAME=\"$netif\""
+            echo "VLAN=yes"
+            echo "PHYSDEV=\"$phydevice\""
+        } >> /tmp/ifcfg/ifcfg-$netif
+    fi
+
     if [ -n "$bond" ] ; then
         # bond interface
         {