]> git.siccegge.de Git - forks/vmdebootstrap.git/commitdiff
Remove persistent udev rules.
authorLars Wirzenius <liw@liw.fi>
Sun, 15 May 2011 10:18:47 +0000 (11:18 +0100)
committerLars Wirzenius <liw@liw.fi>
Sun, 15 May 2011 10:18:47 +0000 (11:18 +0100)
When debootstrap installs udev, it picks up at least the net devices
from the host that is building the image. This is not useful, so we
remove the files. Upon booting the image, udev will re-create the
files, so that's all fine.

vmdebootstrap

index fbba41951c98d519902f975f195fccbeec900906..fcdc774fe18e0e9e9ff5950f082db650d7bc34cb 100755 (executable)
@@ -73,6 +73,7 @@ class VmDebootstrap(cliapp.Application):
             rootdir = self.mount(rootdev)
             self.debootstrap(rootdir)
             self.set_root_password(rootdir)
+            self.remove_udev_persistent_rules(rootdir)
             self.install_extlinux(rootdev, rootdir)
         except:
             self.cleanup()
@@ -164,6 +165,16 @@ class VmDebootstrap(cliapp.Application):
     def set_root_password(self, rootdir):
         self.message('Removing root password')
         self.runcmd(['chroot', rootdir, 'passwd', '-d', 'root'])
+        
+    def remove_udev_persistent_rules(self, rootdir):
+        self.message('Removing udev persistent cd and net rules')
+        for x in ['70-persistent-cd.rules', '70-persistent-net.rules']:
+            pathname = os.path.join(rootdir, 'etc', 'udev', 'rules.d', x)
+            if os.path.exists(pathname):
+                logging.debug('rm %s' % pathname)
+                os.remove(pathname)
+            else:
+                logging.debug('not removing non-existent %s' % pathname)
 
     def install_extlinux(self, rootdev, rootdir):
         self.message('Installing extlinux')