[PATCH] write udev persistent net name rules

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

 



Part of the fix for bug 264901.

Bill
Index: network.py
===================================================================
RCS file: /usr/local/CVS/anaconda/network.py,v
retrieving revision 1.105
diff -u -r1.105 network.py
--- network.py	4 Sep 2007 21:36:40 -0000	1.105
+++ network.py	11 Oct 2007 20:49:59 -0000
@@ -529,5 +529,30 @@
         for ns in self.nameservers():
             if ns:
                 f.write("nameserver %s\n" % (ns,))
+        f.close()
+
+        # /etc/udev/rules.d/70-persistent-net.rules
+        if not os.path.isdir("%s/etc/udev/rules.d" %(instPath,)):
+            iutil.mkdirChain("%s/etc/udev/rules.d" %(instPath,))
+
+        f = open(instPath + "/etc/udev/rules.d/70-persistent-net.rules", "w")
+        f.write("""
+# This file was automatically generated by the /lib/udev/write_net_rules
+# program run by the persistent-net-generator.rules rules file.
+#
+# You can modify it, as long as you keep each rule on a single line.
 
+""")
+        for dev in self.netdevices.values():
+            addr = dev.get("hwaddr")
+            if not addr:
+                continue
+            # rules are case senstive for address. Lame.
+            addr = addr.lower()
+            s = "" 
+            if len(dev.get("DESC")) > 0:
+                s = "# %s\n" % (dev.get("DESC"),)
+            s = s + 'SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS=="?*", ATTR{address}=="%s", NAME="%s"\n' % (addr, dev.get("device"))
+            f.write(s)
+        
         f.close()
Index: packages.py
===================================================================
RCS file: /usr/local/CVS/anaconda/packages.py,v
retrieving revision 1.348
diff -u -r1.348 packages.py
--- packages.py	19 Sep 2007 18:02:10 -0000	1.348
+++ packages.py	11 Oct 2007 20:49:59 -0000
@@ -209,6 +209,7 @@
                  "/var/log/wtmp", "/var/run/utmp",
                  "/dev/log", "/var/lib/rpm", "/", "/etc/raidtab",
                  "/etc/mdadm.conf", "/etc/hosts", "/etc/sysconfig/network",
+                 "/etc/udev/rules.d/70-persistent-net.rules",
                  "/root/install.log", "/root/install.log.syslog",
                  "/etc/shadow", "/etc/shadow-", "/etc/gshadow"]
 

[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