]> git.siccegge.de Git - forks/vmdebootstrap.git/blobdiff - vmdebootstrap
Don't run debootstrap with empty --include=
[forks/vmdebootstrap.git] / vmdebootstrap
index cef188fd0fb77317557dba29b2ae2b8b79a949d4..37b1b78972117d4f90eafed3dc750c0ac9b20ed8 100755 (executable)
@@ -53,6 +53,7 @@ class VmDebootstrap(cliapp.Application):
                                   'install package in DEB file onto system '
                                     '(not from mirror)',
                                   metavar='DEB')
+        self.settings.boolean(['no-kernel'], 'do not install a linux package')
         self.settings.boolean(['enable-dhcp'], 'enable DHCP on eth0')
         self.settings.string(['root-password'], 'set root password',
                              metavar='PASSWORD')
@@ -98,8 +99,8 @@ class VmDebootstrap(cliapp.Application):
             self.create_users(rootdir)
             self.remove_udev_persistent_rules(rootdir)
             self.setup_networking(rootdir)
-            self.install_extlinux(rootdev, rootdir)
             self.customize(rootdir)
+            self.install_extlinux(rootdev, rootdir)
         except BaseException, e:
             self.message('EEEK! Something bad happened...')
             self.cleanup_system()
@@ -108,6 +109,7 @@ class VmDebootstrap(cliapp.Application):
             self.cleanup_system()
 
     def message(self, msg):
+        logging.info(msg)
         if self.settings['verbose']:
             print msg
 
@@ -173,22 +175,24 @@ class VmDebootstrap(cliapp.Application):
     def debootstrap(self, rootdir):
         self.message('Debootstrapping')
 
-        if self.settings['arch'] == 'i386':
-            kernel_arch = '686'
-        else:
-            kernel_arch = self.settings['arch']
-        kernel_image = 'linux-image-2.6-%s' % kernel_arch
+        include = self.settings['package']
+
+        if not self.settings['no-kernel']:
+            if self.settings['arch'] == 'i386':
+                kernel_arch = '686'
+            else:
+                kernel_arch = self.settings['arch']
+            kernel_image = 'linux-image-2.6-%s' % kernel_arch
+            include.append(kernel_image)
 
-        include = [kernel_image] + self.settings['package']
         if self.settings['sudo'] and 'sudo' not in include:
             include.append('sudo')
 
-        self.runcmd(['debootstrap', 
-                     '--arch=%s' % self.settings['arch'],
-                     '--include=%s' % ','.join(include),
-                     self.settings['distribution'],
-                     rootdir, 
-                     self.settings['mirror']])
+        args = ['debootstrap', '--arch=%s' % self.settings['arch']]
+        if include: args.append('--include=%s' % ','.join(include))
+        args += [self.settings['distribution'],
+                 rootdir, self.settings['mirror']]
+        self.runcmd(args)
 
     def set_hostname(self, rootdir):
         hostname = self.settings['hostname']