From: Lars Wirzenius Date: Sun, 15 May 2011 10:18:47 +0000 (+0100) Subject: Remove persistent udev rules. X-Git-Url: https://git.siccegge.de//index.cgi?p=forks%2Fvmdebootstrap.git;a=commitdiff_plain;h=91a3a806c22110ae2ec05f1f839e27ae00e01564 Remove persistent udev rules. 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. --- diff --git a/vmdebootstrap b/vmdebootstrap index fbba419..fcdc774 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -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')