[Pkg-escience-soc2009] [SCM] Tool for creating VM images. branch, master, updated. 997bba691102edb88e5d92e641a8a5c5a72cc659

David Wendt dcrkid at yahoo.com
Tue Jun 16 22:12:13 UTC 2009


The following commit has been merged in the master branch:
commit 3b910998412455ce65c68cd60a235658a9f10d3c
Merge: d6dc1eb48dbf54cefdc99e47485024c0478c4163 a6e3149ef3bac763508aba1dba1f4db6baab75fb
Author: David Wendt <dcrkid at yahoo.com>
Date:   Tue Jun 16 18:07:52 2009 -0400

    Merging in the new VMbuilder 0.11 trunk release. EC2 support is now moved to plugins, amoung other things. Also Canonical changed the license from GPLv3 + "any later version" to just GPLv3.

diff --combined VMBuilder/__init__.py
index f44eea1,3a1edb0..ef97ca8
--- a/VMBuilder/__init__.py
+++ b/VMBuilder/__init__.py
@@@ -1,14 -1,13 +1,13 @@@
  #!/usr/bin/python
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -21,9 -20,10 +20,9 @@@
  #    The publically exposed bits of VMBuilder
  #
  import logging
 -import VMBuilder.plugins
 +from   VMBuilder.plugins    import load_plugins, Plugin
  from   VMBuilder.distro     import Distro
  from   VMBuilder.hypervisor import Hypervisor
 -from   VMBuilder.plugins    import Plugin
  from   VMBuilder.frontend   import Frontend
  from   VMBuilder.vm         import VM
  from   VMBuilder.exception  import VMBuilderException, VMBuilderUserError
@@@ -65,4 -65,4 +64,4 @@@ def run()
      frontend.run()
  
  logging.debug('Loading plugins')
 -VMBuilder.plugins.load_plugins()
 +load_plugins()
diff --combined VMBuilder/disk.py
index 9dd482f,603cb15..96040d3
--- a/VMBuilder/disk.py
+++ b/VMBuilder/disk.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -293,7 -292,7 +292,7 @@@ class Filesystem(object)
              self.uuid = run_cmd('vol_id', '--uuid', self.filename).rstrip()
  
      def mkfs_fstype(self):
 -        if self.vm.suite in ['dapper', 'edgy', 'feisty', 'gutsy']:
 +        if self.vm.suite in ['dapper', 'edgy', 'feisty', 'gutsy', 'etch']:
              logging.debug('%s: 128 bit inode' % self.vm.suite)
              return { TYPE_EXT2: ['mkfs.ext2', '-F'], TYPE_EXT3: ['mkfs.ext3', '-I 128', '-F'], TYPE_XFS: ['mkfs.xfs'], TYPE_SWAP: ['mkswap'] }[self.type]
          else:
diff --combined VMBuilder/frontend.py
index 4dad024,9e4a725..16e7941
--- a/VMBuilder/frontend.py
+++ b/VMBuilder/frontend.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -18,20 -17,22 +17,20 @@@
  #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  #
  #    Frontend interface and classes
 -
 -import VMBuilder
 -import optparse
 +from VMBuilder.exception import VMBuilderException
  
  class Frontend(object):
      def __init__(self):
          self.settings = []
  
 -    def setting_group(self, help=None):
 -        return self.SettingsGroup(help)
 +    def setting_group(self, setting_help=None):
 +        return self.SettingsGroup(setting_help)
      
      def add_setting_group(self, group):
          self.settings.append(group)
  
      def add_setting(self, **kwargs):
 -        self.settings.append(Setting(**kwargs))
 +        self.settings.append(self.Setting(**kwargs))
  
      setting_types =  ['store', 'store']
      class Setting(object):
@@@ -40,8 -41,8 +39,8 @@@
              self.longarg = kwargs.get('shortarg', None)
              self.default = kwargs.get('default', None)
              self.help = kwargs.get('help', None)
 -            type = kwargs.get('type', 'store')
 -            if type not in setting_types:
 +            store_type = kwargs.get('type', 'store')
 +            if store_type not in Frontend.setting_types:
                  raise VMBuilderException("Invalid option type: %s" % type)
  
      class SettingsGroup(Setting):
diff --combined VMBuilder/hypervisor.py
index 6a104a6,46c12ce..23679e8
--- a/VMBuilder/hypervisor.py
+++ b/VMBuilder/hypervisor.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -19,12 -18,12 +18,12 @@@
  #
  #    Hypervisor super class
  
 -import VMBuilder.plugins
 +from VMBuilder import Plugin
  
  STORAGE_DISK_IMAGE = 0
  STORAGE_FS_IMAGE = 1
  
 -class Hypervisor(VMBuilder.plugins.Plugin):
 +class Hypervisor(Plugin):
      def finalize(self):
          raise NotImplemented('Hypervisor subclasses need to implement the finalize method')
  
diff --combined VMBuilder/plugins/__init__.py
index 67ef9cf,044e8c8..6f79260
--- a/VMBuilder/plugins/__init__.py
+++ b/VMBuilder/plugins/__init__.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -20,7 -19,6 +19,7 @@@
  import os
  import VMBuilder
  from VMBuilder.util import run_cmd
 +from VMBuilder.exception import VMBuilderException
  
  def load_plugins():
      for plugin in find_plugins():
diff --combined VMBuilder/plugins/cli/__init__.py
index 503543e,e0f148a..56119a7
--- a/VMBuilder/plugins/cli/__init__.py
+++ b/VMBuilder/plugins/cli/__init__.py
@@@ -1,13 -1,11 +1,16 @@@
  #    Uncomplicated VM Builder
++<<<<<<< HEAD:VMBuilder/plugins/cli/__init__.py
 +#    Copyright (C) 2007-2008 Canonical Ltd.
 +#    Copyright (C) 2009      Bernd Zeimetz <bzed at debian.org>
++=======
+ #    Copyright (C) 2007-2009 Canonical Ltd.
++>>>>>>> vmbuilder_trunk:VMBuilder/plugins/cli/__init__.py
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -25,12 -23,13 +28,16 @@@ import sy
  import textwrap
  import VMBuilder
  from VMBuilder.disk import parse_size
++<<<<<<< HEAD:VMBuilder/plugins/cli/__init__.py
++=======
+ import VMBuilder.hypervisor
++>>>>>>> vmbuilder_trunk:VMBuilder/plugins/cli/__init__.py
  _ = gettext
  
  
  class CLI(VMBuilder.Frontend):
      arg = 'cli'
 -       
 +    
      def run(self):
          try:
              next = False
@@@ -44,15 -43,15 +51,16 @@@
  
              vm = VMBuilder.VM(conf)
              vm.register_setting('--version', action='callback', callback=self.versioninfo, callback_kwargs={ 'vm' : vm }, help='Show version information')
 -            vm.register_setting('--rootsize', metavar='SIZE', default=4096, help='Size (in MB) of the root filesystem [default: %default]')
 -            vm.register_setting('--optsize', metavar='SIZE', default=0, help='Size (in MB) of the /opt filesystem. If not set, no /opt filesystem will be added.')
 -            vm.register_setting('--swapsize', metavar='SIZE', default=1024, help='Size (in MB) of the swap partition [default: %default]')
++
 +            vm.register_setting('--rootsize', metavar='SIZE', type='int', default=4096, help='Size (in MB) of the root filesystem [default: %default]')
 +            vm.register_setting('--optsize', metavar='SIZE', type='int', default=0, help='Size (in MB) of the /opt filesystem. If not set, no /opt filesystem will be added.')
 +            vm.register_setting('--swapsize', metavar='SIZE', type='int', default=1024, help='Size (in MB) of the swap partition [default: %default]')
              vm.register_setting('--raw', metavar='PATH', type='string', help="Specify a file (or block device) to as first disk image.")
              vm.register_setting('--part', metavar='PATH', type='string', help="Allows to specify a partition table in PATH each line of partfile should specify (root first): \n    mountpoint size \none per line, separated by space, where size is in megabytes. You can have up to 4 virtual disks, a new disk starts on a line containing only '---'. ie: \n    root 2000 \n    /boot 512 \n    swap 1000 \n    --- \n    /var 8000 \n    /var/log 2000")
              self.set_usage(vm)
  
              vm.optparser.disable_interspersed_args()
 -            (foo, args) = vm.optparser.parse_args()
 +            args = vm.optparser.parse_args()[1]
              self.handle_args(vm, args)
              vm.optparser.enable_interspersed_args()
  
@@@ -93,7 -92,7 +101,7 @@@
                  vm.add_filesystem(size='%dM' % vm.rootsize, type='ext3', mntpnt='/')
                  vm.add_filesystem(size='%dM' % vm.swapsize, type='swap', mntpnt=None)
                  if vm.optsize > 0:
 -                    vm.add_filesystem(size='%dM' % optsize, type='ext3', mntpnt='/opt')
 +                    vm.add_filesystem(size='%dM' % vm.optsize, type='ext3', mntpnt='/opt')
              else:
                  if vm.raw:
                      disk = vm.add_disk(filename=vm.raw, preallocated=True)
@@@ -161,38 -160,22 +169,38 @@@
                  disk.add_part(offset, int(pair[1]), 'ext3', pair[0])
              offset += int(pair[1])
  
 -class UVB(CLI):
 -    arg = 'ubuntu-vm-builder'
 +class VB(CLI):
 +    arg = 'vb'
 +    suites = []
 +    distro = ''
  
      def set_usage(self, vm):
          vm.optparser.set_usage('%prog hypervisor suite [options]')
          vm.optparser.arg_help = (('hypervisor', vm.hypervisor_help), ('suite', self.suite_help))
  
      def suite_help(self):
 -        return 'Suite. Valid options: %s' % " ".join(VMBuilder.plugins.ubuntu.distro.Ubuntu.suites)
 +        return 'Suite. Valid options: %s' % " ".join(self.suites)
  
      def handle_args(self, vm, args):
          if len(args) < 2:
              vm.optparser.error("You need to specify at least the hypervisor type and the suite")
          vm.set_hypervisor(args[0])
 -        vm.set_distro('ubuntu')
 +        vm.set_distro(self.distro)
          vm.suite = args[1]
   
 +class UVB(VB):
 +    arg = 'ubuntu-vm-builder'
 +    import VMBuilder.plugins.ubuntu as ubuntu
 +    suites = ubuntu.distro.Ubuntu.suites
 +    distro = 'ubuntu'
 +
 +class DVB(VB):
 +    arg = 'debian-vm-builder'
 +    import VMBuilder.plugins.debian as debian
 +    suites = debian.distro.Debian.suites
 +    distro = 'debian'
 +
 +
  VMBuilder.register_frontend(CLI)
  VMBuilder.register_frontend(UVB)
 +VMBuilder.register_frontend(DVB)
diff --combined VMBuilder/plugins/ec2/__init__.py
index 938b5c9,02f2053..f22faeb
--- a/VMBuilder/plugins/ec2/__init__.py
+++ b/VMBuilder/plugins/ec2/__init__.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -17,8 -16,9 +16,9 @@@
  #    You should have received a copy of the GNU General Public License
  #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  #
- from VMBuilder import register_plugin, Plugin, VMBuilderUserError
- from VMBuilder.util import run_cmd
+ import VMBuilder
+ from   VMBuilder import register_plugin, Plugin, VMBuilderUserError, VMBuilderException
+ from   VMBuilder.util import run_cmd
  import logging
  import os
  
@@@ -26,6 -26,9 +26,9 @@@ class EC2(Plugin)
      name = 'EC2 integration'
  
      def register_options(self):
+         # Don't pretend like we can do EC2 
+         if not isinstance(self.vm.hypervisor, VMBuilder.plugins.xen.Xen):
+             return
          group = self.vm.setting_group('EC2 integation')
          group.add_option('--ec2', action='store_true', help='Build for EC2')
          group.add_option('--ec2-name','--ec2-prefix', metavar='EC2_NAME', help='Name for the EC2 image.')
@@@ -37,232 -40,122 +40,322 @@@
          group.add_option('--ec2-secret-key', metavar='SECRET_ID', help='AWS secret access key.')
          group.add_option('--ec2-kernel','--ec2-aki', metavar='AKI', help='EC2 AKI (kernel) to use.')
          group.add_option('--ec2-ramdisk','--ec2-ari', metavar='ARI', help='EC2 ARI (ramdisk) to use.')
- 	group.add_option('--ec2-version',metavar='EC2_VER',help='Specifity the EC2 image version.')
+         group.add_option('--ec2-version', metavar='EC2_VER', help='Specify the EC2 image version.')
+         group.add_option('--ec2-landscape', action='store_true', help='Install landscape client support')
+         group.add_option('--ec2-bundle', action='store_true', help='Bundle the instance')
+         group.add_option('--ec2-upload', action='store_true', help='Upload the instance')
+         group.add_option('--ec2-register', action='store_true', help='Register the instance')
          self.vm.register_setting_group(group)
  
      def preflight_check(self):
-         if not self.vm.ec2:
+         if not getattr(self.vm, 'ec2', False):
              return True
  
+         try:
+             run_cmd('ec2-ami-tools-version')
+         except VMBuilderException, e:
+             raise VMBuilderUserError('You need to have the Amazon EC2 AMI tools installed')
+ 
          if not self.vm.hypervisor.name == 'Xen':
              raise VMBuilderUserError('When building for EC2 you must use the xen hypervisor.')
  
-         if not self.vm.ec2_name:
-             raise VMBuilderUserError('When building for EC2 you must supply the name for the image.')
+         if self.vm.ec2_bundle:
+             if not self.vm.ec2_name:
+                 raise VMBuilderUserError('When building for EC2 you must supply the name for the image.')
  
++<<<<<<< HEAD:VMBuilder/plugins/ec2/__init__.py
 +        if not self.vm.ec2_cert:
 +            if "EC2_CERT" in os.environ:
 +                self.vm.ec2_cert = os.environ["EC2_CERT"]
 +            else:
 +                raise VMBuilderUserError('When building for EC2 you must provide your PEM encoded public key certificate')
 +
 +        if not self.vm.ec2_key:
 +            if "EC2_PRIVATE_KEY" in os.environ:
 +                self.vm.ec2_key = os.environ["EC2_PRIVATE_KEY"]
 +            else:
 +                raise VMBuilderUserError('When building for EC2 you must provide your PEM encoded private key file')
++=======
+             if not self.vm.ec2_cert:
+                 if "EC2_CERT" in os.environ:
+                     self.vm.ec2_cert = os.environ["EC2_CERT"]
+                 else:
+                     raise VMBuilderUserError('When building for EC2 you must provide your PEM encoded public key certificate')
+ 
+             if not self.vm.ec2_key:
+                 if "EC2_PRIVATE_KEY" in os.environ:
+                     self.vm.ec2_key = os.environ["EC2_PRIVATE_KEY"]
+                 else:
+                     raise VMBuilderUserError('When building for EC2 you must provide your PEM encoded private key file')
++>>>>>>> vmbuilder_trunk:VMBuilder/plugins/ec2/__init__.py
  
-         if not self.vm.ec2_user:
-             raise VMBuilderUserError('When building for EC2 you must provide your EC2 user ID (your AWS account number, not your AWS access key ID)')
+             if not self.vm.ec2_user:
+                 raise VMBuilderUserError('When building for EC2 you must provide your EC2 user ID (your AWS account number, not your AWS access key ID)')
  
++<<<<<<< HEAD:VMBuilder/plugins/ec2/__init__.py
 +        if not self.vm.ec2_kernel:
 +            logging.debug('No ec2-aki choosen setting to default. Use --ec2-kernel to change this')
 +	    if self.vm.suite == 'hardy':
 +               if self.vm.arch == 'amd64':
 +	          self.vm.ec2_kernel = 'aki-6f709706'
 +	       else:
 +	          self.vm.ec2_kernel = 'aki-6e709707'
 +	    elif self.vm.suite == 'intrepid':
 +	        if self.vm.arch == 'amd64':
 +                   self.vm.ec2_kernel = 'aki-4f4daa26'
 +	        else: 
 +	           self.vm.ec2_kernel = 'aki-714daa18' 
 +	    elif self.vm.suite == 'jaunty':
 +                if self.vm.arch == 'amd64':
 +                    self.vm.ec2_kernel = 'aki-6507e00c'
 +                else:
 +	            self.vm.ec2_kernel = 'aki-6407e00d'
 +
 +        logging.info('%s - AKI to be used.' %(self.vm.ec2_kernel))
 +	logging.info('WARNING! You might be using an outdated AKI. Please check xxx')
 +
 +        if not self.vm.ec2_ramdisk:
 +            logging.debug('No ec2-ari choosen setting to default. Use --ec2-ramdisk to change this.')
 +	    if self.vm.suite == 'hardy':
 +              if self.vm.arch == 'amd64':
 +                 self.vm.ec2_ramdisk = 'ari-61709708'
 +              else:
 +                 self.vm.ec2_ramdisk = 'ari-6c709705'
 +	    elif self.vm.suite == 'intrepid':
 +                if self.vm.arch == 'amd64':
 +                   self.vm.ec2_ramdisk = 'ari-4c4daa25' 
 +                else:
 +                   self.vm.ec2_ramdisk = 'ari-7e4daa17'
 +	    elif self.vm.suite == 'jaunty':
 +                if self.vm.arch == 'amd64':
 +	           self.vm.ec2_ramdisk = 'ari-6307e00a'
 +                else:
 +	           self.vm.ec2_ramdisk = 'ari-6207e00b'
 +
 +	logging .info('%s - ARI to be used.'%(self.vm.ec2_ramdisk))
 +	logging.info('WARNING! You might be using an outdated AKI. Please check xxx')
++=======
+             if not self.vm.ec2_kernel:
+                 self.vm.ec2_kernel = self.vm.distro.get_ec2_kernel()
+                 logging.debug('%s - to be used for AKI.' %(self.vm.ec2_kernel))
+ 
+             if not self.vm.ec2_ramdisk:
+                 self.vm.ec2_ramdisk = self.vm.distro.ec2_ramdisk_id()
+                 logging.debug('%s - to be use for the ARI.' %(self.vm.ec2_ramdisk))
++>>>>>>> vmbuilder_trunk:VMBuilder/plugins/ec2/__init__.py
  
-         if not self.vm.ec2_bucket:
-             raise VMBuilderUserError('When building for EC2 you must provide an S3 bucket to hold the AMI')
+             if self.vm.ec2_upload:
+                 if not self.vm.ec2_bucket:
+                     raise VMBuilderUserError('When building for EC2 you must provide an S3 bucket to hold the AMI')
  
-         if not self.vm.ec2_access_key:
-             raise VMBuilderUserError('When building for EC2 you must provide your AWS access key ID.')
+                 if not self.vm.ec2_access_key:
+                     raise VMBuilderUserError('When building for EC2 you must provide your AWS access key ID.')
  
-         if not self.vm.ec2_secret_key:
-             raise VMBuilderUserError('When building for EC2 you must provide your AWS secret access key.')
+                 if not self.vm.ec2_secret_key:
+                     raise VMBuilderUserError('When building for EC2 you must provide your AWS secret access key.')
  
++<<<<<<< HEAD:VMBuilder/plugins/ec2/__init__.py
 +	logging.info('Installing common software')
 +	self.install_common()
 +	if self.vm.suite == 'hardy':
 +             self.install_hardy()
 +	elif self.vm.suite == 'intrepid':
 +              self.install_intrepid()
 +	elif self.vm.suite == 'jaunty':
 +              self.install_jaunty()
++=======
+         if not self.vm.ec2_version:
+             raise VMBuilderUserError('When building for EC2 you must provide version info.')
+ 
+         if not self.vm.addpkg:
+              self.vm.addpkg = []
+ 
+         self.vm.addpkg += ['ec2-init',
+                           'openssh-server',
+                           'ec2-modules',
+                           'standard^',
+                           'ec2-ami-tools',
+                           'update-motd']
+ 
+         if self.vm.ec2_landscape:
+             logging.info('Installing landscape support')
+             self.vm.addpkg += ['landscape-client']
+ 
+         if not self.vm.ppa:
+             self.vm.ppa = []
+ 
+         self.vm.ppa += ['ubuntu-on-ec2/ppa']
++>>>>>>> vmbuilder_trunk:VMBuilder/plugins/ec2/__init__.py
  
      def post_install(self):
-         if not self.vm.ec2:
+         if not getattr(self.vm, 'ec2', False):
              return
  
          logging.info("Running ec2 postinstall")
++<<<<<<< HEAD:VMBuilder/plugins/ec2/__init__.py
 +	logging.info("Running common post install")
 +	if self.vm.suite == 'hardy':
 +	     self.postinstall_hardy()
 +	elif self.vm.suite == 'intrepid':
 +	     self.postinstall_intrepid()
 +	elif self.vm.suite == 'jaunty':
 +	     self.postinstall_jaunty()
 +	self.postinstall_common()
 +
 +    def deploy(self):
 +        if not self.vm.ec2:
 +            return False
 +
 +        logging.info("Building EC2 bundle")
 +        bundle_cmdline = ['ec2-bundle-image', '--image', self.vm.filesystems[0].filename, '--cert', self.vm.ec2_cert, '--privatekey', self.vm.ec2_key, '--user', self.vm.ec2_user, '--prefix', self.vm.ec2_name, '-r', ['i386', 'x86_64'][self.vm.arch == 'amd64'], '-d', self.vm.workdir, '--kernel', self.vm.ec2_kernel, '--ramdisk', self.vm.ec2_ramdisk]
++=======
+         self.install_from_template('/etc/ec2_version', 'ec2_version', { 'version' : self.vm.ec2_version } )
+         self.install_from_template('/etc/ssh/sshd_config', 'sshd_config')
+         self.install_from_template('/etc/sudoers', 'sudoers')
  
-         run_cmd(*bundle_cmdline)
+         if self.vm.ec2_landscape:
+             self.install_from_template('/etc/default/landscape-client', 'landscape_client')
++>>>>>>> vmbuilder_trunk:VMBuilder/plugins/ec2/__init__.py
  
+         self.vm.distro.disable_hwclock_access()
+ 
++<<<<<<< HEAD:VMBuilder/plugins/ec2/__init__.py
 +        logging.info("Uploading EC2 bundle")
 +        upload_cmdline = ['ec2-upload-bundle', '--retry', '--manifest', '%s/%s.manifest.xml' % (self.vm.workdir, self.vm.ec2_name), '--bucket', self.vm.ec2_bucket, '--access-key', self.vm.ec2_access_key, '--secret-key', self.vm.ec2_secret_key]
 +        run_cmd(*upload_cmdline)
++=======
+     def deploy(self):
+         if not getattr(self.vm, 'ec2', False):
+             return False
++>>>>>>> vmbuilder_trunk:VMBuilder/plugins/ec2/__init__.py
+ 
+         if self.vm.ec2_bundle:
+             logging.info("Building EC2 bundle")
+             bundle_cmdline = ['ec2-bundle-image', '--image', self.vm.filesystems[0].filename, '--cert', self.vm.ec2_cert, '--privatekey', self.vm.ec2_key, '--user', self.vm.ec2_user, '--prefix', self.vm.ec2_name, '-r', ['i386', 'x86_64'][self.vm.arch == 'amd64'], '-d', self.vm.workdir, '--kernel', self.vm.ec2_kernel, '--ramdisk', self.vm.ec2_ramdisk]
+             run_cmd(*bundle_cmdline)
  
-         from boto.ec2.connection import EC2Connection
-         conn = EC2Connection(self.vm.ec2_access_key, self.vm.ec2_secret_key)
-         print conn.register_image('%s/%s.manifest.xml' % (self.vm.ec2_bucket, self.vm.ec2_name))
+             manifest = '%s/%s.manifest.xml' % (self.vm.workdir, self.vm.ec2_name)
+             if self.vm.ec2_upload:
+                 logging.info("Uploading EC2 bundle")
+                 upload_cmdline = ['ec2-upload-bundle', '--retry', '--manifest', manifest, '--bucket', self.vm.ec2_bucket, '--access-key', self.vm.ec2_access_key, '--secret-key', self.vm.ec2_secret_key]
+                 run_cmd(*upload_cmdline)
+ 
+                 if self.vm.ec2_register:
+                     from boto.ec2.connection import EC2Connection
+                     conn = EC2Connection(self.vm.ec2_access_key, self.vm.ec2_secret_key)
+                     conn.register_image('%s/%s.manifest.xml' % (self.vm.ec2_bucket, self.vm.ec2_name))
+             else:
+                 self.vm.result_files.append(manifest)
+         else:
+             self.vm.result_files.append(self.vm.filesystems[0].filename)
  
          return True
  
 +    def install_common(self):
 +        if not self.vm.ec2:
 +            return False
 +
 +	if not self.vm.addpkg:
 +	    self.vm.addpkg = []
 +
 +	logging.info('Installing common software.')
 +	self.vm.addpkg += ['openssh-server', 
 +                           'ec2-init', 
 +                           'standard^',
 +		           'ec2-ami-tools',
 +                           'update-motd',
 +                           'curl',
 +                           'screen',
 +                           'screen-profiles']
 +
 +	if not self.vm.ppa:
 +	    self.vm.ppa = []
 +
 +        self.vm.ppa += ['ubuntu-on-ec2']
 +
 +    def install_hardy(self):
 +	if not self.vm.ec2:
 +	    return False
 +
 +	logging.info('Installing software for hardy.')
 +	self.vm.addpkg += ['ruby',
 +			   'libc6-xen',
 +			   'ec2-modules',
 +			   'libopenssl-ruby',
 +			   'landscape-common',
 +			   'landscape-client']
 +
 +
 +    def postinstall_hardy(self):
 +	if not self.vm.ec2:
 +	    return False
 +
 +	logging.info('Running post-install for hardy')
 +	# work around for libc6/xen bug in hardy.
 +	self.install_from_template('/etc/ld.so.conf.d/libc6-xen.conf', 'xen-ld-so-conf')
 +	self.run_in_target('apt-get', 'remove', '-y', 'libc6-i686')
 +
 +	self.install_from_template('/etc/update-motd.d/51_update-motd', '51_update-motd-hardy')
 +	self.install_from_template('/etc/event.d/xvc0', 'xvc0')
 +	self.run_in_target('update-rc.d', '-f', 'hwclockfirst.sh', 'remove')
 +
 +    def install_intrepid(self):
 +	if not self.vm.ec2:
 +	    return False
 +
 +	logging.info('Installing software for intrepid')
 +	self.vm.addpkg += ['ec2-modules',
 +			   'ruby',
 +			   'libopenssl-ruby',
 +                           'server^',
 +                           'policykit',
 +			   'landscape-common',
 +			   'landscape-client']
 +
 +    def postinstall_intrepid(self):
 +	if not self.vm.ec2:
 +	    return False
 +
 +	logging.info('Running post-install for intrepid')
 +	self.install_from_template('/etc/update-motd.d/51_update-motd', '51_update-motd-intrepid')
 +
 +    def install_jaunty(self):
 +	if not self.vm.ec2:
 +	    return False
 +
 +	logging.info('Installing software for jaunty')
 +	self.vm.addpkg += ['ec2-modules',
 +			   'ruby1.8',
 +                           'server^',
 +			   'libopenssl-ruby1.8']
 +
 +    def postinall_jaunty(self):
 +	if not self.vm.ec2:
 +            return False
 +	
 +	logging.info('Running post-install for jaunty') 
 +	self.install_from_template('/etc/update-motd.d/51_update-motd', '51_update-motd-intrepid')
 +
 +    def postinstall_common(self):
 +	if not self.vm.ec2:
 +	    return False
 +
 +	logging.info('Running common post-install')
 +	self.install_from_template('/etc/ssh/sshd_config', 'sshd_config')
 +	self.run_in_target('chpasswd', '-e', stdin='ubuntu:!\n')
 +	# this makes my skin crawl
 +	self.install_from_template('/etc/sudoers', 'sudoers')
 +	# this doesnt
 +	self.run_in_target('chmod', '755', '/etc/update-motd.d/51_update-motd')
 +	self.install_from_template('/etc/ec2_version', 'ec2_version', { 'version' : self.vm.ec2_version })
 +
 +	self.run_in_target('rm', '-f', '/etc/localtime')
 +	self.run_in_target('ln', '-s', '/usr/share/zoneinfo/UTC', '/etc/localtime')
 +
 +	self.run_in_target('usermod', '-u', '135', 'ubuntu')
 +	self.run_in_target('chown', '-R', 'ubuntu', '/home/ubuntu')
 +
 +	self.run_in_target('update-rc.d', '-f', 'hwclock.sh', 'remove') 
 +	self.install_from_template('/etc/default/landscape-client', 'landscape_client')
 +
  register_plugin(EC2)
diff --combined VMBuilder/plugins/firstscripts/__init__.py
index 99c97e0,d7d18b8..5cf5643
--- a/VMBuilder/plugins/firstscripts/__init__.py
+++ b/VMBuilder/plugins/firstscripts/__init__.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -41,17 -40,11 +40,17 @@@ class Firstscripts(Plugin)
          
          if self.vm.firstboot:
              logging.debug("Checking if firstboot script %s exists" % (self.vm.firstboot,))
 +	    if not(os.access(self.vm.firstboot, os.X_OK)):
 +	        raise MBuilderUserError("The first-boot script is not executable")
 +
              if not(os.path.isfile(self.vm.firstboot)):
                  raise VMBuilderUserError('The path to the first-boot script is invalid: %s. Make sure you are providing a full path.' % self.vm.firstboot)
                  
          if self.vm.firstlogin:
              logging.debug("Checking if first login script %s exists" % (self.vm.firstlogin,))
 +            if not(os.access(self.vm.firstlogin, os.X_OK)):
 +                raise VMBuilderUserError("The first-login script is not executable")
 +
              if not(os.path.isfile(self.vm.firstlogin)):
                  raise VMBuilderUserError('The path to the first-login script is invalid: %s.  Make sure you are providing a full path.' % self.vm.firstlogin)
  
diff --combined VMBuilder/plugins/ubuntu/dapper.py
index f598dad,9f18da4..912e476
--- a/VMBuilder/plugins/ubuntu/dapper.py
+++ b/VMBuilder/plugins/ubuntu/dapper.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -20,12 -19,12 +19,12 @@@
  import glob
  import logging
  import os
 -import suite
  import shutil
  import socket
  import tempfile
  import VMBuilder
  import VMBuilder.disk as disk
 +import VMBuilder.suite as suite
  from   VMBuilder.util import run_cmd
  
  class Dapper(suite.Suite):
@@@ -82,12 -81,6 +81,6 @@@
              logging.debug("Creating device.map")
              self.install_device_map()
  
-         logging.debug("Installing ssh keys")
-         self.install_authorized_keys()
- 
- 	logging.debug("Install xen kernel")
- 	self.install_xen_kernel()
- 
          logging.debug("Installing extra packages")
          self.install_extras()
  
@@@ -100,6 -93,9 +93,9 @@@
          logging.debug("Copy host settings")
          self.copy_settings()
  
+         logging.debug("Setting timezone")
+         self.set_timezone()
+ 
          logging.debug("Making sure system is up-to-date")
          self.update()
  
@@@ -109,6 -105,10 +105,10 @@@
          logging.debug("Unmounting volatile lrm filesystems")
          self.unmount_volatile()
  
+         if hasattr(self.vm, 'ec2') and self.vm.ec2:
+             logging.debug("Configuring for ec2")
+             self.install_ec2()
+ 
          logging.debug("Unpreventing daemons from starting")
          self.unprevent_daemons_starting()
  
@@@ -142,8 -142,15 +142,20 @@@
          else:
              self.run_in_target('chpasswd', '-e', stdin='root:!\n')
  
++<<<<<<< HEAD:VMBuilder/plugins/ubuntu/dapper.py
 +    def create_initial_user(self):
 +        self.run_in_target('adduser', '--disabled-password', '--gecos', self.vm.name, self.vm.user)
++=======
+         if self.vm.lock_user:
+             logging.info('Locking %s' %(self.vm.user))
+             self.run_in_target('chpasswd', '-e', stdin=('%s:!\n' %(self.vm.user)))
+ 
+     def create_initial_user(self):
+         if self.vm.uid:
+             self.run_in_target('adduser', '--disabled-password', '--uid', self.vm.uid, '--gecos', self.vm.name, self.vm.user)
+         else:
+             self.run_in_target('adduser', '--disabled-password', '--gecos', self.vm.name, self.vm.user)
++>>>>>>> vmbuilder_trunk:VMBuilder/plugins/ubuntu/dapper.py
          self.run_in_target('addgroup', '--system', 'admin')
          self.run_in_target('adduser', self.vm.user, 'admin')
  
@@@ -251,9 -258,7 +263,7 @@@
  
  
      def install_mirrors(self):
-         if self.vm.iso:
-             mirror = "file:///isomnt"
-         elif self.vm.install_mirror:
+         if self.vm.install_mirror:
              mirror = self.vm.install_mirror
          else:
              mirror = self.vm.mirror
@@@ -324,3 -329,18 +334,21 @@@
  
      def install_vmbuilder_log(self, logfile, rootdir):
          shutil.copy(logfile, '%s/var/log/vmbuilder-install.log' % (rootdir,))
++<<<<<<< HEAD:VMBuilder/plugins/ubuntu/dapper.py
++=======
+ 
+     def set_timezone(self):
+         if self.vm.timezone:
+             self.unlink('%s/etc/localtime' % self.destdir)
+             shutil.copy('%s/usr/share/zoneinfo/%s' % (self.destdir, self.vm.timezone), '%s/etc/localtime' % (self.destdir,))
+ 
+     def install_ec2(self):
+         if self.vm.ec2:
+             logging.debug('This suite does not support ec2')
+ 
+     def disable_hwclock_access(self):
+         fp = open('%s/etc/default/rcS' % self.destdir, 'a')
+         fp.write('HWCLOCKACCESS=no')
+         fp.close()
+ 
++>>>>>>> vmbuilder_trunk:VMBuilder/plugins/ubuntu/dapper.py
diff --combined VMBuilder/plugins/ubuntu/distro.py
index bb47ff3,6e7d9f1..95ec85e
--- a/VMBuilder/plugins/ubuntu/distro.py
+++ b/VMBuilder/plugins/ubuntu/distro.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -63,6 -62,7 +62,7 @@@ class Ubuntu(Distro)
          group.add_option('--components', metavar='COMPS', help='A comma seperated list of distro components to include (e.g. main,universe).')
          group.add_option('--ppa', metavar='PPA', action='append', help='Add ppa belonging to PPA to the vm\'s sources.list.')
          group.add_option('--lang', metavar='LANG', default=self.get_locale(), help='Set the locale to LANG [default: %default]')
+         group.add_option('--timezone', action='store_true', help='Set the timezone to the vm.')
          self.vm.register_setting_group(group)
  
          group = self.vm.setting_group('Settings for the initial user')
@@@ -70,6 -70,9 +70,11 @@@
          group.add_option('--name', default='Ubuntu', help='Full name of initial user [default: %default]')
          group.add_option('--pass', default='ubuntu', help='Password of initial user [default: %default]')
          group.add_option('--rootpass', help='Initial root password (WARNING: this has strong security implications).')
++
+         group.add_option('--uid', help='Initial UID value.')
+         group.add_option('--gid', help='Initial GID value.')
+         group.add_option('--lock-user', action='store_true', help='Lock the initial user [default %default]')
++
          self.vm.register_setting_group(group)
  
          group = self.vm.setting_group('Other options')
@@@ -133,6 -136,10 +138,13 @@@
                  msg = "locale-gen does not recognize your locale '%s'" % self.vm.lang
                  raise VMBuilderUserError(msg)
  
++<<<<<<< HEAD:VMBuilder/plugins/ubuntu/distro.py
++=======
+         if self.vm.ec2:
+             self.get_ec2_kernel()
+             self.get_ec2_ramdisk()
+ 
++>>>>>>> vmbuilder_trunk:VMBuilder/plugins/ubuntu/distro.py
      def install(self, destdir):
          self.destdir = destdir
          self.suite.install(destdir)
@@@ -180,13 -187,29 +192,29 @@@ EOT'''
          else:
              raise VMBuilderUserError('There is no valid xen kernel for the suite selected.')
  
-     def xen_kernel_path(self):
-         path = '/boot/vmlinuz-%s-%s' % (self.xen_kernel_version(), self.suite.xen_kernel_flavour)
+     def xen_kernel_initrd_path(self, which):
+         path = '/boot/%s-%s-%s' % (which, self.xen_kernel_version(), self.suite.xen_kernel_flavour)
          return path
  
+     def xen_kernel_path(self):
+         return self.xen_kernel_initrd_path('kernel')
+ 
      def xen_ramdisk_path(self):
-         path = '/boot/initrd.img-%s-%s' % (self.xen_kernel_version(), self.suite.xen_kernel_flavour)
-         return path
+         return self.xen_kernel_initrd_path('ramdisk')
+ 
+     def get_ec2_kernel(self):
+         if self.suite.ec2_kernel_info:
+             return self.suite.ec2_kernel_info[self.vm.arch]
+         else:
+             raise VMBuilderUserError('EC2 is not supported for the suite selected')
+ 
+     def get_ec2_ramdisk(self):
+         if self.suite.ec2_ramdisk_info:
+             return self.suite.ec2_ramdisk_info[self.vm.arch]
+         else:
+             raise VMBuilderUserError('EC2 is not supported for the suite selected')
  
+     def disable_hwclock_access(self):
+         return self.suite.disable_hwclock_access()
  
  register_distro(Ubuntu)
diff --combined VMBuilder/plugins/ubuntu/edgy.py
index 3e3fba9,b2afbb1..4c9742e
--- a/VMBuilder/plugins/ubuntu/edgy.py
+++ b/VMBuilder/plugins/ubuntu/edgy.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -18,10 -17,10 +17,10 @@@
  #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  #
  import logging
  import shutil
  import os
  import VMBuilder.disk as disk
 +import VMBuilder.suite as suite
  from   VMBuilder.util import run_cmd
  from   VMBuilder.plugins.ubuntu.dapper import Dapper
  
diff --combined VMBuilder/plugins/ubuntu/feisty.py
index c89ab5b,42c3ac5..5c9e19f
--- a/VMBuilder/plugins/ubuntu/feisty.py
+++ b/VMBuilder/plugins/ubuntu/feisty.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -18,8 -17,8 +17,8 @@@
  #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  #
  import logging
 -import suite
  import VMBuilder.disk as disk
 +import VMBuilder.suite as suite
  from   VMBuilder.util import run_cmd
  from   VMBuilder.plugins.ubuntu.edgy import Edgy
  
diff --combined VMBuilder/plugins/ubuntu/gutsy.py
index 5cefcd1,5b9fe2e..58df14d
--- a/VMBuilder/plugins/ubuntu/gutsy.py
+++ b/VMBuilder/plugins/ubuntu/gutsy.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -18,8 -17,8 +17,8 @@@
  #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  #
  import logging
 -import suite
  import VMBuilder.disk as disk
 +import VMBuilder.suite as suite
  from   VMBuilder.util import run_cmd
  from   VMBuilder.plugins.ubuntu.feisty import Feisty
  
diff --combined VMBuilder/plugins/ubuntu/hardy.py
index 3ce1caf,e28a13f..f5181d6
--- a/VMBuilder/plugins/ubuntu/hardy.py
+++ b/VMBuilder/plugins/ubuntu/hardy.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -18,24 -17,24 +17,35 @@@
  #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  #
  import suite
 +import logging
 +import VMBuilder
 +from VMBuilder.util		    import run_cmd
  from VMBuilder.plugins.ubuntu.gutsy import Gutsy
  
  class Hardy(Gutsy):
      virtio_net = True
+     ec2_kernel_info = { 'i386' : 'aki-6e709707', 'amd64' : 'aki-6f709706' }
+     ec2_ramdisk_info = { 'i386' : 'ari-6c709705', 'amd64' : 'ari-61709708' }
+ 
+     def install_ec2(self):
+         self.run_in_target('apt-get' ,'--force-yes', '-y', 'install', 'libc6-xen')
+         self.run_in_target('apt-get','--purge','--force-yes', '-y', 'remove', 'libc6-i686')
+         self.install_from_template('/etc/event.d/xvc0', 'upstart', { 'console' : 'xvc0' })
+         self.install_from_template('/etc/ld.so.conf.d/libc6-xen.conf', 'xen-ld-so-conf')
+         self.run_in_target('update-rc.d', '-f', 'hwclockfirst.sh', 'remove')
+         self.install_from_template('/etc/update-motd.d/51_update-motd', '51_update-motd-hardy')
+         self.run_in_target('chmod', '755', '/etc/update-motd.d/51_update-motd')
  
      def xen_kernel_path(self):
 -        return '/boot/vmlinuz-2.6.24-19-xen'
 +	rcmd = run_cmd('chroot', self.destdir, 'dpkg', '-S', 'xen')
 +	temp = rcmd[0].split(": ")
 +	xen_kernel = temp[0].split("linux-image-")
 +	path = '/boot/vmlinuz-%s' %xen_kernel
 +	return path
  
      def xen_ramdisk_path(self):
 -        return '/boot/initrd.img-2.6.24-19-xen'
 +	rcmd = run_cmd('chroot', self.destdir, 'dpkg', '-S', 'xen')
 +	temp = rcmd[0].split(": ")
 +	xen_ramdisk = temp[0].split("linux-image-")
 +	path = '/boot/initrd.img-%s' %xen_ramdisk
 +	return path
diff --combined VMBuilder/plugins/ubuntu/intrepid.py
index cc5bb98,e0b313a..fc648d7
--- a/VMBuilder/plugins/ubuntu/intrepid.py
+++ b/VMBuilder/plugins/ubuntu/intrepid.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -17,9 -16,9 +16,9 @@@
  #    You should have received a copy of the GNU General Public License
  #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  #
 -import suite
  import logging
  import VMBuilder.disk as disk
 +import VMBuilder.suite as suite
  from   VMBuilder.util import run_cmd
  from   VMBuilder.plugins.ubuntu.hardy import Hardy
  
@@@ -29,14 -28,18 +28,24 @@@ class Intrepid(Hardy)
                         'lpia'  : ['lpia', 'lpiacompat'] }
      default_flavour = { 'i386' : 'virtual', 'amd64' : 'virtual', 'lpia' : 'lpia' }
      xen_kernel_flavour = 'virtual'
 +
+     ec2_kernel_info = { 'i386' : 'aki-714daa18', 'amd64' : 'aki-4f4daa26' }
+     ec2_ramdisk_info = { 'i386': 'ari-7e4daa17', 'amd64' : 'ari-4c4daa25' }
+ 
+     def install_ec2(self):
+ # workaround for policy bug on ubuntu-server. (see bug #275432)
+         self.run_in_target('apt-get', '--force-yes', '-y', 'install', 'policykit')
+         self.run_in_target('apt-get', '--force-yes', '-y', 'install', 'server^')
+         self.install_from_template('/etc/update-motd.d/51_update-motd', '51_update-motd')
+         self.run_in_target('chmod', '755', '/etc/update-motd.d/51_update-motd')
+ 
      def mangle_grub_menu_lst(self):
          bootdev = disk.bootpart(self.vm.disks)
          run_cmd('sed', '-ie', 's/^# kopt=root=\([^ ]*\)\(.*\)/# kopt=root=UUID=%s\\2/g' % bootdev.fs.uuid, '%s/boot/grub/menu.lst' % self.destdir)
          run_cmd('sed', '-ie', 's/^# groot.*/# groot=%s/g' % bootdev.fs.uuid, '%s/boot/grub/menu.lst' % self.destdir)
          run_cmd('sed', '-ie', '/^# kopt_2_6/ d', '%s/boot/grub/menu.lst' % self.destdir)
 +    def install_xen_kernel(self):
 +	import VMBuilder.plugins.xen
 +
 +	if isinstance(self.vm.hypervisor, VMBuilder.plugins.xen.Xen):
 +	   logging.info('Skipping Xen kernel installation.')
diff --combined VMBuilder/plugins/ubuntu/jaunty.py
index edb8eee,5d1af35..6514716
--- a/VMBuilder/plugins/ubuntu/jaunty.py
+++ b/VMBuilder/plugins/ubuntu/jaunty.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -17,14 -16,21 +16,21 @@@
  #    You should have received a copy of the GNU General Public License
  #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  #
 -import suite
  import logging
  import VMBuilder.disk as disk
 +import VMBuilder.suite as suite
  from   VMBuilder.util import run_cmd
  from   VMBuilder.plugins.ubuntu.intrepid import Intrepid
  
  class Jaunty(Intrepid):
      xen_kernel_flavour = 'server'
+     ec2_kernel_info = { 'i386' : 'aki-c553b4ac', 'amd64' : 'aki-d653b4bf' }
+     ec2_ramdisk_info = { 'i386' : 'ari-c253b4ab', 'amd64' : 'ari-d753b4be' }
+ 
+     def install_ec2(self):
+         self.run_in_target('apt-get', '--force-yes', '-y', 'install', 'server^')
+         self.install_from_template('/etc/update-motd.d/51_update-motd', '51_update-motd')
+         self.run_in_target('chmod', '755', '/etc/update-motd.d/51_update-motd')
  
      def mangle_grub_menu_lst(self):
          bootdev = disk.bootpart(self.vm.disks)
@@@ -42,8 -48,3 +48,3 @@@
          else:
              self.run_in_target('chpasswd', '-e', stdin='root:!\n')
  
-     def install_xen_kernel(self):
- 	import VMBuilder.plugins.xen
- 
-   	if isinstance(self.vm.hypervisor, VMBuilder.plugins.xen.Xen):
- 	    logging.info('Skipping Xen kernel installation.')
diff --combined VMBuilder/plugins/virtualbox/templates/vm_deploy_script.tmpl
index baad6f8,9c5137f..0d39637
--- a/VMBuilder/plugins/virtualbox/templates/vm_deploy_script.tmpl
+++ b/VMBuilder/plugins/virtualbox/templates/vm_deploy_script.tmpl
@@@ -1,5 -1,5 +1,5 @@@
  #raw
- #! /usr/bin/env sh
+ #! /usr/bin/env bash
  ###############################################################################
  #
  # This script is used to create und register a new VM
@@@ -10,9 -10,14 +10,13 @@@
  #import os
  #import os.path
  
- os_type="Linux"
 -
+ #if $os_type == "Ubuntu"
+ os_type="Ubuntu"
+ #else
+ os_type="Other"
+ #end if
  
- disk_path="#echo os.path.abspath(os.path.dirname($vm_disks[0]))#/"
+ disk_path="#echo os.path.abspath(os.path.dirname($vm_disks[0]))#"
  
  
  VBoxManage createvm -name $vm_name -ostype \$os_type -register
@@@ -55,3 -60,6 +59,6 @@@ VBoxManage modifyvm $vm_name -nic1 na
  VBoxManage modifyvm $vm_name -nic1 intnet 
  #end if
  #end if
+ 
+ #activating PAE support for the CPU because some OS (e.g. ubuntu server ) won't boot in a virtual machine without it
+ VBoxManage modifyvm $vm_name -pae on
diff --combined VMBuilder/util.py
index 2ebaf35,367e3fa..6ebc2d5
--- a/VMBuilder/util.py
+++ b/VMBuilder/util.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -180,13 -179,10 +179,13 @@@ def render_template(plugin, vm, tmplnam
  
      for dir in tmpldirs:
          tmplfile = '%s/%s.tmpl' % (dir, tmplname)
 +        logging.debug('Trying template \'%s\'' %(tmplfile))
          if os.path.exists(tmplfile):
              t = Template(file=tmplfile, searchList=searchList)
              output = t.respond()
              logging.debug('Output from template \'%s\': %s' % (tmplfile, output))
              return output
 +        else:
 +            logging.debug('Template \'%s\' not found' %(tmplfile))
  
      raise VMBuilderException('Template %s.tmpl not found in any of %s' % (tmplname, ', '.join(tmpldirs)))
diff --combined VMBuilder/vm.py
index ab116f5,09e5e39..8782917
--- a/VMBuilder/vm.py
+++ b/VMBuilder/vm.py
@@@ -1,13 -1,12 +1,12 @@@
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -76,7 -75,7 +75,7 @@@ class VM(object)
  
          self.fsmounted = False
  
-         self.optparser = _MyOptParser(epilog="ubuntu-vm-builder is Copyright (C) 2007-2008 Canonical Ltd. and written by Soren Hansen <soren at canonical.com>.", usage='%prog hypervisor distro [options]')
+         self.optparser = _MyOptParser(epilog="ubuntu-vm-builder is Copyright (C) 2007-2009 Canonical Ltd. and written by Soren Hansen <soren at canonical.com>.", usage='%prog hypervisor distro [options]')
          self.optparser.arg_help = (('hypervisor', self.hypervisor_help), ('distro', self.distro_help))
  
          self.confparser = ConfigParser.SafeConfigParser()
@@@ -301,7 -300,7 +300,7 @@@
                  if (ipclass > 0) and (ipclass <= 127):
                      mask = 0xFF
                  elif (ipclass > 128) and (ipclass < 192):
 -                    mask = OxFFFF
 +                    mask = 0xFFFF
                  elif (ipclass < 224):
                      mask = 0xFFFFFF
                  else:
diff --combined debian-vm-builder
index 564e928,2d5ea0b..ece33f6
--- a/debian-vm-builder
+++ b/debian-vm-builder
@@@ -1,15 -1,13 +1,14 @@@
  #!/usr/bin/python
  #
  #    Uncomplicated VM Builder
- #    Copyright (C) 2007-2008 Canonical Ltd.
+ #    Copyright (C) 2007-2009 Canonical Ltd.
 +#    Copyright (C) 2009      Bernd Zeimetz <bzed at debian.org>
  #    
  #    See AUTHORS for list of contributors
  #
  #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License as published by
- #    the Free Software Foundation, either version 3 of the License, or
- #    (at your option) any later version.
+ #    it under the terms of the GNU General Public License version 3, as
+ #    published by the Free Software Foundation.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -26,5 -24,5 +25,5 @@@
  
  import VMBuilder
  
--VMBuilder.set_frontend('ubuntu-vm-builder')
++VMBuilder.set_frontend('debian-vm-builder')
  VMBuilder.run()
diff --combined setup.py
index b488597,662d822..44eb2e2
--- a/setup.py
+++ b/setup.py
@@@ -1,5 -1,3 +1,5 @@@
 +#!/usr/bin/python
 +
  from distutils.core import setup
  import VMBuilder.plugins
  from glob import glob
@@@ -17,7 -15,7 +17,7 @@@ if os.path.exists('.bzr')
          print repr(e)
      
  setup(name='VMBuilder',
-       version='0.9',
+       version='0.11',
        description='Uncomplicated VM Builder',
        author='Soren Hansen',
        author_email='soren at canonical.com',

-- 
Tool for creating VM images.



More information about the Pkg-escience-soc2009 mailing list