summaryrefslogtreecommitdiffstats
path: root/0001-Generate-correct-ifcfg-file-for-vlan-option.patch
blob: 84a1d10e3836702d83fd342e4192934ff0383d51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 030b00b8a5499a1d2150730ae412a356f40ca5a4 Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@redhat.com>
Date: Wed, 31 Jul 2013 15:18:20 +0200
Subject: [PATCH] Generate correct ifcfg file for vlan= option.

---
 modules.d/45ifcfg/write-ifcfg.sh | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index 2e78c49..dcb2aef 100755
--- a/modules.d/45ifcfg/write-ifcfg.sh
+++ b/modules.d/45ifcfg/write-ifcfg.sh
@@ -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
         {