]> git.siccegge.de Git - forks/vmdebootstrap.git/blobdiff - vmdebootstrap
Fix eth0 to come up automatically
[forks/vmdebootstrap.git] / vmdebootstrap
index 5b4fa96187affa0fef7d292718eadd2d097554a5..a7a67e10bff214c9a06ceb2eba2b92a340ac188d 100755 (executable)
@@ -115,6 +115,7 @@ class VmDebootstrap(cliapp.Application):
             self.customize(rootdir)
             if self.settings['image']:
                 self.install_extlinux(rootdev, rootdir)
+                self.optimize_image(rootdir)
             if self.settings['tarball']:
                 self.create_tarball(rootdir)
         except BaseException, e:
@@ -309,7 +310,7 @@ class VmDebootstrap(cliapp.Application):
         
         if self.settings['enable-dhcp']:
             f.write('\n')
-            f.write('allow-hotplug eth0\n')
+            f.write('auto eth0\n')
             f.write('iface eth0 inet dhcp\n')
             
         f.close()
@@ -364,7 +365,16 @@ append initrd=%(initrd)s root=UUID=%(uuid)s ro %(kserial)s
         self.runcmd(['extlinux', '--install', rootdir])
         self.runcmd(['sync'])
         import time; time.sleep(2)
-        
+
+    def optimize_image(self, rootdir):
+        """
+        Filing up the image with zeros will increase its compression rate
+        """
+        zeros = os.path.join(rootdir, 'ZEROS')
+        self.runcmd_unchecked(['dd', 'if=/dev/zero', 'of=' + zeros, 'bs=1M'])
+        self.runcmd(['rm', '-f', zeros])
+
+
     def cleanup_system(self):
         # Clean up after any errors.