diff options
author | Bill Nottingham <notting@redhat.com> | 2007-10-11 21:44:05 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2007-10-11 21:44:05 +0000 |
commit | add1114d7d0664631ab3636a176384e660f191fd (patch) | |
tree | 54c1d5f52db6843587b2fb1293dadbf85790348e /network.py | |
parent | 3b88d41d76d3918f0c6590bd3f1a7799aa689253 (diff) | |
download | anaconda-add1114d7d0664631ab3636a176384e660f191fd.tar.gz anaconda-add1114d7d0664631ab3636a176384e660f191fd.tar.xz anaconda-add1114d7d0664631ab3636a176384e660f191fd.zip |
2007-10-11 Bill Nottingham <notting@redhat.com>
* network.py: write persistent udev network device name rules (#264901)
* packages.py: restore SELinux context on rules file
Diffstat (limited to 'network.py')
-rw-r--r-- | network.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/network.py b/network.py index ef530b15a..d55b7770e 100644 --- a/network.py +++ b/network.py @@ -530,5 +530,30 @@ class Network: 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() |