[PATCH master 2/4] Update generating of anaconda-ks.cfg for ipv6.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 pyanaconda/network.py |   74 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 74 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index d4c6bb5..d3b81f6 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -522,6 +522,80 @@ class Network:
         for devName in devNames:
             dev = self.netdevices[devName]
 
+            line = "network"
+
+            # ipv4 and ipv6
+            if dev.get("ONBOOT"):
+                line += " --onboot %" % dev.get("ONBOOT")
+            line += " --device %" % dev.get("DEVICE")
+            if dev.get('MTU') and dev.get('MTU') != "0":
+                line += " --mtu=%s" % dev.get('MTU')
+
+            # ipv4
+            if not dev.get('BOOTPROTO'):
+                line += " --noipv4"
+            else:
+                if dev.get('BOOTPROTO').lower() == 'dhcp':
+                    line += " --bootproto dhcp"
+                    if dev.get('DHCPCLASS'):
+                        line += " --dhcpclass %s" % dev.get('DHCPCLASS')
+                elif dev.get('IPADDR'):
+                    line += " --bootproto static --ip %s" % dev.get('IPADDR')
+                    netmask = dev.get('NETMASK')
+                    prefix  = dev.get('PREFIX')
+                    if not netmask and prefix:
+                        netmask = isys.prefix2netmask(int(prefix))
+                    if netmask:
+                        line += " --netmask %s" % netmask
+                    # note that --gateway is common for ipv4 and ipv6
+                    if dev.get('GATEWAY'):
+                        line += " --gateway %s" % dev.get('GATEWAY')
+
+            # ipv6
+            if (not dev.get('IPV6INIT') or
+                dev.get('IPV6INIT') == "no"):
+                line += " --noipv6"
+            else:
+                if dev.get('IPV6_AUTOCONF') == "yes":
+                    line += " --ipv6 auto"
+                else:
+                    if dev.get('IPV6ADDR'):
+                        line += " --ipv6 %s" % dev.get('IPV6ADDR')
+                        if dev.get('IPV6_DEFAULTGW'):
+                            line += " --gateway %s" % dev.get('IPV6_DEFAULTGW')
+                    if dev.get('DHCPV6') == "yes":
+                        line += " --ipv6 dhcp"
+
+            # ipv4 and ipv6
+            dnsline = ''
+            for key in dev.info.keys():
+                if key.upper().startswith('DNS'):
+                    if dnsline == '':
+                        dnsline = dev.get(key)
+                    else:
+                        dnsline += "," + dev.get(key)
+            if dnsline:
+                line += " --nameserver %s" % dnsline
+
+            if dev.get("ETHTOOL_OPTS"):
+                line += " --ethtool %s" % dev.get("ETHTOOL_OPTS")
+
+            if dev.get("ESSID"):
+                line += " --essid %s" % dev.get("ESSID")
+
+            # hostname
+            if (self.overrideDHCPhostname or
+                dev.get('BOOTPROTO').lower() != "dhcp"):
+                if (self.hostname and
+                    self.hostname != "localhost.localdomain"):
+                    line += " --hostname %s" % self.hostname
+
+            line += "\n"
+            f.write(line)
+
+        for devName in devNames:
+            dev = self.netdevices[devName]
+
             if dev.get('bootproto').lower() == 'dhcp' or dev.get('ipaddr'):
                 f.write("network --device %s" % dev.get('device'))
 
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux