diff -Nru vm-builder-0.12.4+bzr477/debian/changelog vm-builder-0.12.4+bzr494/debian/changelog --- vm-builder-0.12.4+bzr477/debian/changelog 2017-12-20 08:54:17.000000000 +0000 +++ vm-builder-0.12.4+bzr494/debian/changelog 2017-12-20 08:50:53.000000000 +0000 @@ -1,3 +1,77 @@ +vm-builder (0.12.4+bzr494-0ubuntu2~precise) precise; urgency=medium + + * Set force-confnew option on apt-get update. + + -- Like Ma Wed, 20 Dec 2017 16:49:55 +0800 + +vm-builder (0.12.4+bzr494-0ubuntu1) xenial; urgency=medium + + * Patch from Tinco Andringa to use uuids for partitions + * Make kpartx synchronous to avoid race + * Merge debian support from ~josephbisch + * Add support for releases up to xenial + + -- Serge Hallyn Thu, 29 Oct 2015 20:36:21 -0500 + +vm-builder (0.12.4+bzr489-0ubuntu2) trusty; urgency=medium + + * Re-introduce ort to dh_python2. + * Mark myself as the maintainer. + + -- Serge Hallyn Tue, 04 Mar 2014 16:47:22 -0600 + +vm-builder (0.12.4+bzr489-0ubuntu1) trusty; urgency=medium + + * Add trusty to list of releases + + -- Serge Hallyn Tue, 04 Mar 2014 16:35:24 -0600 + +vm-builder (0.12.4+bzr488-0ubuntu2) trusty; urgency=medium + + * Port to dh_python2. + + -- Dimitri John Ledkov Sun, 26 Jan 2014 23:29:43 +0000 + +vm-builder (0.12.4+bzr488-0ubuntu1) saucy; urgency=low + + * Incorporate fix to specify macaddr when using bridge (LP: #392097) + + -- Serge Hallyn Mon, 24 Jun 2013 14:40:27 -0500 + +vm-builder (0.12.4+bzr487-0ubuntu1) saucy; urgency=low + + * Add raring and saucy to valid ubuntu suites. (LP: #1174148) + + -- Serge Hallyn Mon, 29 Apr 2013 11:13:08 -0500 + +vm-builder (0.12.4+bzr482-0ubuntu1) raring; urgency=low + + * Merge from ~rmurri/vmbuilder/bug-1080744 (LP: #1080744) + + -- Serge Hallyn Fri, 23 Nov 2012 15:00:10 -0600 + +vm-builder (0.12.4+bzr481-0ubuntu1) quantal; urgency=low + + [ Yoann Dubreuil ] + * Fix proxy support: set up apt proxies before writing sources.list. + (LP: #966944) + + -- Serge Hallyn Mon, 06 Aug 2012 14:39:54 -0500 + +vm-builder (0.12.4+bzr480-0ubuntu1) quantal; urgency=low + + * Patch from Alex Dehnert (adehnert) to fix tmpfs unmounting failure + (LP: #1008225) + * From Scott Moser: fix vmbuilder --version output (LP: #1003230) + + -- Serge Hallyn Mon, 23 Jul 2012 23:10:58 -0500 + +vm-builder (0.12.4+bzr478-0ubuntu1) quantal; urgency=low + + * add support for building quantal VMs + + -- Serge Hallyn Mon, 30 Apr 2012 21:00:52 -0500 + vm-builder (0.12.4+bzr477-0ubuntu1) precise; urgency=low [louis-bouchard] @@ -213,7 +287,7 @@ * debian/python-vm-builder.py, debian/python-vm-builder.py, debian/ubuntu-vm-builder.install: Install apport hooks, apart - of the server-lucid-apport-hooks specification. + of the server-lucid-apport-hooks specification. -- Chuck Short Tue, 02 Feb 2010 14:15:31 -0500 @@ -345,7 +419,7 @@ vm-builder (0.9-0ubuntu5) jaunty; urgency=low - * add Jaunty support + * add Jaunty support -- Jamie Strandboge Wed, 03 Dec 2008 17:41:12 -0600 @@ -366,12 +440,12 @@ allows to specify the device the partition should be mapped to. If the size is set to 0, it is considered a "dummy" partition that should not be created, only added to fstab. - + [ Chuck Short ] * Add retry option when uploading to Amazon * Install server and standard seed by default * Add ec2 examples for first login and first boot - + [ Eric Hammond ] * Fix post_install bugs LP: #292888, LP: #292891 & LP: #292901 * Fix regression on locale settings LP: #292573 @@ -390,7 +464,7 @@ vm-builder (0.9-0ubuntu3) intrepid; urgency=low [ Johan Euphrosine ] - * Fix exception when suite provided does not exist (LP: #281801) + * Fix exception when suite provided does not exist (LP: #281801) and provide unit test for it. [ Chuck Short ] @@ -418,10 +492,10 @@ * Documented unusual conf name value in help to fix bug LP: #284614 * Fixed a bug in set_defaults occuring on reading untyped value from the configuration file - * Match ec2 vocabulary by adding option name and clarifying help + * Match ec2 vocabulary by adding option name and clarifying help (LP: #284765, LP: #285170, LP: #285165) * Added a check for xen hypervisor when ec2 is selected (LP: #285191) - * Added checks for presence of bucket, access key and secret key for ec2 + * Added checks for presence of bucket, access key and secret key for ec2 (LP: #284757) * Older suite need 128 bit inode for grub to recognize os. Thanks to Albert Damen for the pointer (LP: #285093) @@ -444,7 +518,7 @@ [ Nicolas Barcet ] * Added hint for more help (LP: #269323) * Added firstscripts plugin to fix regression on --firstboot and --firstlogin (LP: #268957) - * Added postinst plugin to fix regression on --exec and add --copy (LP: #268955) + * Added postinst plugin to fix regression on --exec and add --copy (LP: #268955) * Added man page. [ Soren Hansen ] @@ -462,13 +536,13 @@ * Fixed regression on --ip and friends (LP: #268920) * Added missing dependancy on dpkg-dev (LP: #270324) * Fixed regression on --part (LP: #268718) - + -- Soren Hansen Wed, 24 Sep 2008 09:58:35 +0200 vm-builder (0.8.1-0ubuntu3) intrepid; urgency=low [Soren Hansen ] - * Re-add VMWare support. (LP: #268140) + * Re-add VMWare support. (LP: #268140) * Fixed sources.list generation for Ubuntu. (LP: #268155) * Added configuration file handling. (LP: #268170) * Fix up Xen support (device and configuration file creation). (LP: #268142) @@ -502,12 +576,12 @@ [Thierry Carrez] * Patch to fix lilo prompt (fix LP: #206763) - + [Loic Minier] * Add support for "security mirror"; --security-mirror flag, SECURITY_MIRROR config; defaults to security.u.c/ubuntu for official arches and to ports.ubuntu.com/ubuntu-ports for lpia. - + [Nicolas Barcet] * Merge --in-place option from Hardy. * Fix case when domain is not defined on the host, thanks to Thierry Carrez @@ -563,7 +637,7 @@ * Added --raw option to install on raw devices/files. WARNING: the variables used in template files for disk definition have been modified. Please insure that locally created templates are updated to - reflect this change. + reflect this change. * Add --firstboot and --firstlogin options * First login always execute "sudo dpkg-reconfigure console-setup" so that the local keyboard setting is taken into account. @@ -573,7 +647,7 @@ * Include hostname in default destination directory if defined * Do not use a tmpfs by default anymore * Place the working directory in the same directory as dest if using --tmp - - * Added --tmpfs option to specify usage of a tmpfs for the working directory + * Added --tmpfs option to specify usage of a tmpfs for the working directory * VM specific parameters do not need to be the last ones anymore * Unknown parameters now return an error and prints usage * Added --overwrite for overwriting of destination directory and libvirt diff -Nru vm-builder-0.12.4+bzr477/debian/control vm-builder-0.12.4+bzr494/debian/control --- vm-builder-0.12.4+bzr477/debian/control 2017-12-20 08:54:17.000000000 +0000 +++ vm-builder-0.12.4+bzr494/debian/control 2017-12-20 03:14:21.000000000 +0000 @@ -1,11 +1,11 @@ Source: vm-builder Section: utils Priority: optional -Maintainer: Soren Hansen +Maintainer: Serge Hallyn Build-Depends: cdbs, debhelper (>= 5.0.38), python-all (>= 2.3.5-11), - python-central (>= 0.5.6), + dh-python, python-epydoc, quilt Standards-Version: 3.8.3 @@ -26,7 +26,6 @@ rsync Recommends: python-libvirt, devscripts -XB-Python-Version: ${python:Versions} Description: VM builder Script that automates the process of creating a ready to use Linux based VM. The currently supported hypervisors are: @@ -49,7 +48,6 @@ Depends: ${misc:Depends}, ${python:Depends}, python-vm-builder -XB-Python-Version: ${python:Versions} Description: Ubuntu VM builder Script which automates the process of creating a ready to use VM based on Ubuntu. You can pass command line options to add extra packages, remove @@ -65,7 +63,6 @@ python-vm-builder, ec2-ami-tools, python-boto -XB-Python-Version: ${python:Versions} Description: EC2 Ubuntu VM builder Ubuntu vmbuilder module that automates the process of create a ready to use EC2 image (AMI) based on Ubuntu. You can pass command line options to add diff -Nru vm-builder-0.12.4+bzr477/debian/rules vm-builder-0.12.4+bzr494/debian/rules --- vm-builder-0.12.4+bzr477/debian/rules 2017-12-20 08:54:17.000000000 +0000 +++ vm-builder-0.12.4+bzr494/debian/rules 2017-12-20 03:14:21.000000000 +0000 @@ -1,6 +1,6 @@ #!/usr/bin/make -f -DEB_PYTHON_SYSTEM = pycentral +DEB_PYTHON2_MODULE_PACKAGES:=ubuntu-vm-builder python-vm-builder python-vm-builder-ec2 include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/rules/patchsys-quilt.mk include /usr/share/cdbs/1/class/python-distutils.mk diff -Nru vm-builder-0.12.4+bzr477/setup.py vm-builder-0.12.4+bzr494/setup.py --- vm-builder-0.12.4+bzr477/setup.py 2010-05-18 11:43:12.000000000 +0000 +++ vm-builder-0.12.4+bzr494/setup.py 2017-12-20 03:14:21.000000000 +0000 @@ -1,3 +1,4 @@ +#!/usr/bin/env python from distutils.core import setup import VMBuilder.plugins from glob import glob diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/contrib/cli.py vm-builder-0.12.4+bzr494/VMBuilder/contrib/cli.py --- vm-builder-0.12.4+bzr477/VMBuilder/contrib/cli.py 2011-10-27 20:01:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/contrib/cli.py 2017-12-20 03:14:21.000000000 +0000 @@ -62,7 +62,7 @@ group.add_option('--overwrite', '-o', action='store_true', - help='Configuration file') + help='Remove destination directory before starting build') group.add_option('--config', '-c', type='str', @@ -153,14 +153,19 @@ if os.geteuid() != 0: raise VMBuilderUserError('Must run as root') + logging.debug("Launch directory: {}".format(os.getcwd())) + distro.overwrite = hypervisor.overwrite = self.options.overwrite destdir = self.options.destdir or ('%s-%s' % (distro.arg, hypervisor.arg)) + logging.debug("Output destdir: {}".format(destdir)) if self.options.tmpfs and self.options.chroot_dir: raise VMBuilderUserError('--chroot-dir and --tmpfs can not be used together.') if os.path.exists(destdir): + if os.path.realpath(destdir) == os.getcwd(): + raise VMBuilderUserError('Current working directory cannot be used as a destination directory') if self.options.overwrite: logging.debug('%s existed, but -o was specified. ' 'Nuking it.' % destdir) @@ -277,7 +282,7 @@ optparser.add_option_group(optgroup) def versioninfo(self, option, opt, value, parser): - print ('%(major)d.%(minor)d.%(micro)s.r%(revno)d' % + print ('%(major)d.%(minor)d.%(micro)s' % VMBuilder.get_version_info()) sys.exit(0) @@ -348,10 +353,10 @@ try: for line in file(self.options.part): elements = line.strip().split(' ') - if len(elements) < 4: - tmpfile = util.tmp_filename(tmp_root=self.options.tmp_root) - else: - tmpfile = elements[3] + if len(elements) < 4: + tmpfile = util.tmp_filename(tmp_root=self.options.tmp_root) + else: + tmpfile = elements[3] if elements[0] == 'root': hypervisor.add_filesystem(elements[1], diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/disk.py vm-builder-0.12.4+bzr494/VMBuilder/disk.py --- vm-builder-0.12.4+bzr477/VMBuilder/disk.py 2012-01-25 13:48:24.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/disk.py 2017-12-20 03:14:21.000000000 +0000 @@ -127,7 +127,7 @@ """ logging.info('Creating loop devices corresponding to the created partitions') self.vm.add_clean_cb(lambda : self.unmap(ignore_fail=True)) - kpartx_output = run_cmd('kpartx', '-av', self.filename) + kpartx_output = run_cmd('kpartx', '-asv', self.filename) parts = [] for line in kpartx_output.split('\n'): if line == "" or line.startswith("gpt:") or line.startswith("dos:"): diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/hypervisor.py vm-builder-0.12.4+bzr494/VMBuilder/hypervisor.py --- vm-builder-0.12.4+bzr477/VMBuilder/hypervisor.py 2011-05-16 20:00:30.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/hypervisor.py 2017-12-20 03:14:21.000000000 +0000 @@ -59,6 +59,7 @@ self.nics = [self.NIC()] self.call_hooks('preflight_check') self.call_hooks('configure_networking', self.nics) + self.call_hooks('create_partitions') self.call_hooks('configure_mounting', self.disks, self.filesystems) self.chroot_dir = tmpdir() @@ -78,9 +79,8 @@ destdir) self.call_hooks('deploy', destdir) - def mount_partitions(self, mntdir): - """Mounts all the vm's partitions and filesystems below .rootmnt""" - logging.info('Mounting target filesystems') + def create_partitions(self): + """Creates all the vms partitions and formats them """ for fs in self.filesystems: fs.create() fs.mkfs() @@ -89,6 +89,10 @@ disk.partition() disk.map_partitions() disk.mkfs() + + def mount_partitions(self, mntdir): + """Mounts all the vm's partitions and filesystems below .rootmnt""" + logging.info('Mounting target filesystems') fss = VMBuilder.disk.get_ordered_filesystems(self) for fs in fss: fs.mount(mntdir) diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/log.py vm-builder-0.12.4+bzr494/VMBuilder/log.py --- vm-builder-0.12.4+bzr477/VMBuilder/log.py 2010-02-22 21:21:50.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/log.py 2017-12-20 03:14:21.000000000 +0000 @@ -34,3 +34,4 @@ console.setFormatter(logging.Formatter(format)) logging.getLogger('').addHandler(console) +logging.info("logging to file: {}".format(logfile)) diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/distro.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/distro.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/distro.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/distro.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,286 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2007-2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import logging +import os +import shutil +import stat +import VMBuilder +from VMBuilder import register_distro, Distro +from VMBuilder.util import run_cmd +from VMBuilder.exception import VMBuilderUserError, VMBuilderException + +class Debian(Distro): + name = 'Debian' + arg = 'debian' + suites = ['potato', 'woody', 'sarge', 'etch', 'lenny', + 'squeeze', 'wheezy', 'jessie', 'stretch' ] + + # Maps host arch to valid guest archs + valid_archs = { 'amd64' : ['amd64', 'i386' ], + 'i386' : [ 'i386' ] } + + xen_kernel = '' + + def register_options(self): + group = self.setting_group('Package options') + group.add_setting('addpkg', type='list', metavar='PKG', help='Install PKG into the guest (can be specified multiple times).') + group.add_setting('removepkg', type='list', metavar='PKG', help='Remove PKG from the guest (can be specified multiple times)') + group.add_setting('seedfile', metavar="SEEDFILE", help='Seed the debconf database with the contents of this seed file before installing packages') + + group = self.setting_group('General OS options') + self.host_arch = run_cmd('dpkg', '--print-architecture').rstrip() + group.add_setting('arch', extra_args=['-a'], default=self.host_arch, help='Specify the target architecture. Valid options: amd64 i386 (defaults to host arch)') + group.add_setting('hostname', default='debian', help='Set NAME as the hostname of the guest. Default: debian. Also uses this name as the VM name.') + + group = self.setting_group('Installation options') + group.add_setting('suite', default='jessie', help='Suite to install. Valid options: %s [default: %%default]' % ' '.join(self.suites)) + group.add_setting('flavour', extra_args=['--kernel-flavour'], help='Kernel flavour to use. Default and valid options depend on architecture and suite') + group.add_setting('variant', metavar='VARIANT', help='Passed to debootstrap --variant flag; use minbase, buildd, or fakechroot.') + group.add_setting('debootstrap-tarball', metavar='FILE', help='Passed to debootstrap --unpack-tarball flag.') + group.add_setting('iso', metavar='PATH', help='Use an iso image as the source for installation of file. Full path to the iso must be provided. If --mirror is also provided, it will be used in the final sources.list of the vm. This requires suite and kernel parameter to match what is available on the iso, obviously.') + group.add_setting('mirror', metavar='URL', help='Use Debian mirror at URL instead of the default, which is http://ftp.debian.org/debian for official arches and http://ports.ubuntu.com/ubuntu-ports otherwise') + group.add_setting('proxy', metavar='URL', help='Use proxy at URL for cached packages') + group.add_setting('install-mirror', metavar='URL', help='Use Debian mirror at URL for the installation only. Apt\'s sources.list will still use default or URL set by --mirror') + group.add_setting('security-mirror', metavar='URL', help='Use Debian security mirror at URL instead of the default, which is http://security.debian.org/debian-security.') + group.add_setting('install-security-mirror', metavar='URL', help='Use the security mirror at URL for installation only. Apt\'s sources.list will still use default or URL set by --security-mirror') + group.add_setting('components', type='list', metavar='COMPS', help='A comma seperated list of distro components to include (e.g. main,universe).') + group.add_setting('lang', metavar='LANG', default=get_locale(), help='Set the locale to LANG [default: %default]') + group.add_setting('timezone', metavar='TZ', default='UTC', help='Set the timezone to TZ in the vm. [default: %default]') + + group = self.setting_group('Settings for the initial user') + group.add_setting('user', default='debian', help='Username of initial user [default: %default]') + group.add_setting('name', default='Debian', help='Full name of initial user [default: %default]') + group.add_setting('pass', default='debian', help='Password of initial user [default: %default]') + group.add_setting('rootpass', help='Initial root password (WARNING: this has strong security implications).') + group.add_setting('uid', type='int', help='Initial UID value.') + group.add_setting('gid', help='Initial GID value.') + group.add_setting('lock-user', type='bool', default=False, help='Lock the initial user [default: %default]') + + group = self.setting_group('Other options') + group.add_setting('ssh-key', metavar='PATH', help='Add PATH to root\'s ~/.ssh/authorized_keys (WARNING: this has strong security implications).') + group.add_setting('ssh-user-key', help='Add PATH to the user\'s ~/.ssh/authorized_keys.') + group.add_setting('manifest', metavar='PATH', help='If passed, a manifest will be written to PATH') + + def set_defaults(self): + self.set_setting_default('mirror', 'http://ftp.debian.org/debian') + self.set_setting_default('security-mirror', 'http://security.debian.org/debian-security') + + self.set_setting_default('components', ['main']) + + def preflight_check(self): + """While not all of these are strictly checks, their failure would inevitably + lead to failure, and since we can check them before we start setting up disk + and whatnot, we might as well go ahead an do this now.""" + + suite = self.get_setting('suite') + if not suite in self.suites: + raise VMBuilderUserError('Invalid suite: "%s". Valid suites are: %s' % (suite, ' '.join(self.suites))) + + modname = 'VMBuilder.plugins.debian.%s' % (suite, ) + mod = __import__(modname, fromlist=[suite]) + self.suite = getattr(mod, suite.capitalize())(self) + + arch = self.get_setting('arch') + if arch not in self.valid_archs[self.host_arch] or \ + not self.suite.check_arch_validity(arch): + raise VMBuilderUserError('%s is not a valid architecture. Valid architectures are: %s' % (arch, + ' '.join(self.valid_archs[self.host_arch]))) + + components = self.get_setting('components') + if not components: + self.set_config_value_list = ['main', 'contrib'] + else: + if type(components) is str: + self.vm.components = self.vm.components.split(',') + + self.context.virtio_net = self.use_virtio_net() + + # check if the seedfile exists if one is to be used + seedfile = self.context.get_setting('seedfile') + if seedfile and not os.path.exists(seedfile): + raise VMBuilderUserError("Seedfile '%s' does not exist" % seedfile) + + lang = self.get_setting('lang') + +# FIXME +# if getattr(self.vm, 'ec2', False): +# self.get_ec2_kernel() +# self.get_ec2_ramdisk() +# self.apply_ec2_settings() + + def bootstrap(self): + self.suite.debootstrap() + self.suite.pre_install() + + def configure_os(self): + self.suite.install_apt_proxy() + self.suite.install_sources_list() + self.suite.create_devices() + self.suite.prevent_daemons_starting() + self.suite.mount_dev_proc() + self.suite.install_extras() + self.suite.create_initial_user() + self.suite.install_authorized_keys() + self.suite.set_timezone() + self.suite.set_locale() + self.suite.update() + self.suite.install_sources_list(final=True) + self.suite.run_in_target('apt-get', 'clean'); + self.suite.unmount_volatile() + self.suite.unmount_proc() + self.suite.unmount_dev_pts() + self.suite.unmount_dev() + self.suite.unprevent_daemons_starting() + self.suite.create_manifest() + + def configure_networking(self, nics): + self.suite.config_host_and_domainname() + self.suite.config_interfaces(nics) + + def configure_mounting(self, disks, filesystems): + self.suite.install_fstab(disks, filesystems) + + def install(self, destdir): + self.destdir = destdir + self.suite.install(destdir) + + def install_vmbuilder_log(self, logfile, rootdir): + self.suite.install_vmbuilder_log(logfile, rootdir) + + def post_mount(self, fs): + self.suite.post_mount(fs) + + def use_virtio_net(self): + return self.suite.virtio_net + + def install_bootloader_cleanup(self, chroot_dir): + self.context.cancel_cleanup(self.install_bootloader_cleanup) + tmpdir = '%s/tmp/vmbuilder-grub' % chroot_dir + for disk in os.listdir(tmpdir): + if disk != 'device.map': + run_cmd('umount', os.path.join(tmpdir, disk)) + shutil.rmtree(tmpdir) + + def install_kernel(self, destdir): + self.suite.install_kernel(destdir) + + def install_bootloader(self, chroot_dir, disks): + root_dev = VMBuilder.disk.bootpart(disks).get_grub_id() + + tmpdir = '/tmp/vmbuilder-grub' + os.makedirs('%s%s' % (chroot_dir, tmpdir)) + self.context.add_clean_cb(self.install_bootloader_cleanup) + devmapfile = os.path.join(tmpdir, 'device.map') + devmap = open('%s%s' % (chroot_dir, devmapfile), 'w') + for (disk, id) in zip(disks, range(len(disks))): + new_filename = os.path.join(tmpdir, os.path.basename(disk.filename)) + open('%s%s' % (chroot_dir, new_filename), 'w').close() + run_cmd('mount', '--bind', disk.filename, '%s%s' % (chroot_dir, new_filename)) + st = os.stat(disk.filename) + if stat.S_ISBLK(st.st_mode): + for (part, part_id) in zip(disk.partitions, range(len(disk.partitions))): + part_mountpnt = '%s%s%d' % (chroot_dir, new_filename, part_id+1) + open(part_mountpnt, 'w').close() + run_cmd('mount', '--bind', part.filename, part_mountpnt) + devmap.write("(hd%d) %s\n" % (id, new_filename)) + devmap.close() + run_cmd('cat', '%s%s' % (chroot_dir, devmapfile)) + self.suite.install_grub(chroot_dir) + self.run_in_target('grub', '--device-map=%s' % devmapfile, '--batch', stdin='''root %s +setup (hd0) +EOT''' % root_dev) + self.suite.install_menu_lst(disks) + self.install_bootloader_cleanup(chroot_dir) + + def xen_kernel_version(self): + if self.suite.xen_kernel_flavour: + # if this is ec2, do not call rmadison. + # this could be replaced with a method to get most recent + # stable kernel, but really, this is not used at all for ec2 + if hasattr(self.context, 'ec2') and self.context.ec2: + logging.debug("selecting ec2 kernel") + self.xen_kernel = "2.6.ec2-kernel" + return self.xen_kernel + if not self.xen_kernel: + rmad = run_cmd('rmadison', 'linux-image-%s' % self.suite.xen_kernel_flavour) + version = ['0', '0','0', '0'] + + for line in rmad.splitlines(): + sline = line.split('|') + + if sline[2].strip().startswith(self.context.get_setting('suite')): + vt = sline[1].strip().split('.') + for i in range(4): + if int(vt[i]) > int(version[i]): + version = vt + break + + if version[0] == '0': + raise VMBuilderException('Something is wrong, no valid xen kernel for the suite %s found by rmadison' % self.context.suite) + + self.xen_kernel = '%s.%s.%s-%s' % (version[0],version[1],version[2],version[3]) + return self.xen_kernel + else: + raise VMBuilderUserError('There is no valid xen kernel for the suite selected.') + + 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): + 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.context.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.context.arch] + else: + raise VMBuilderUserError('EC2 is not supported for the suite selected') + + def disable_hwclock_access(self): + return self.suite.disable_hwclock_access() + + def apply_ec2_settings(self): + return self.suite.apply_ec2_settings() + + def has_256_bit_inode_ext3_support(self): + return self.suite.has_256_bit_inode_ext3_support() + + def preferred_filesystem(self): + return self.suite.preferred_filesystem + +def get_locale(): + lang = os.getenv('LANG') + if lang is None: + return 'C' + # People's $LANG looks different since lucid, but locale-gen still + # wants the old format. + if lang.endswith('utf8'): + return lang[:-4] + 'UTF-8' + return lang + +register_distro(Debian) diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/etch.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/etch.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/etch.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/etch.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2007-2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.debian.sarge import Sarge + +class Etch(Sarge): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/__init__.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/__init__.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/__init__.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,19 @@ +# +# Uncomplicated VM Builder +# 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import distro diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/jessie.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/jessie.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/jessie.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/jessie.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2007-2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.debian.wheezy import Wheezy + +class Jessie(Wheezy): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/lenny.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/lenny.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/lenny.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/lenny.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2007-2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.debian.etch import Etch + +class Lenny(Etch): + disk_prefix = 'sd' diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/potato.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/potato.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/potato.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/potato.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,387 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2007-2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import glob +import logging +import os +import suite +import shutil +import tempfile +import VMBuilder.disk as disk +from VMBuilder.util import run_cmd +from VMBuilder.exception import VMBuilderException + +class Potato(suite.Suite): + updategrub = "/usr/sbin/update-grub" + grubroot = "/usr/lib/grub" + valid_flavours = { 'i386' : ['486', '586', '686-pae'], + 'amd64' : ['amd64']} + default_flavour = { 'i386' : '686-pae', 'amd64' : 'amd64' } + disk_prefix = 'hd' + xen_kernel_flavour = None + virtio_net = False + chpasswd_cmd = [ 'chpasswd', '--md5' ] + preferred_filesystem = 'ext3' + + def pre_install(self): + pass + + def check_kernel_flavour(self, arch, flavour): + return flavour in self.valid_flavours[arch] + + def check_arch_validity(self, arch): + return arch in self.valid_flavours.keys() + + def install(self, destdir): + raise VMBuilderException('Do not call this method!') + + # These are still missing after the refactoring. + logging.debug("Creating device.map") + self.install_device_map() + + logging.debug("Copy host settings") + self.copy_settings() + + if hasattr(self.context, 'ec2') and self.context.ec2: + logging.debug("Configuring for ec2") + self.install_ec2() + + def create_manifest(self): + manifest = self.context.get_setting('manifest') + if manifest: + logging.debug("Creating manifest") + manifest_contents = self.run_in_target('dpkg-query', '-W', '--showformat=${Package} ${Version}\n') + fp = open(manifest, 'w') + fp.write(manifest_contents) + fp.close + self.call_hook('fix_ownership', manifest) + + def update(self): + self.run_in_target('apt-get', '-y', '--force-yes', 'dist-upgrade', + env={ 'DEBIAN_FRONTEND' : 'noninteractive' }) + + def install_authorized_keys(self): + ssh_key = self.context.get_setting('ssh-key') + if ssh_key: + os.mkdir('%s/root/.ssh' % self.context.chroot_dir, 0700) + shutil.copy(ssh_key, '%s/root/.ssh/authorized_keys' % self.context.chroot_dir) + os.chmod('%s/root/.ssh/authorized_keys' % self.context.chroot_dir, 0644) + + user = self.context.get_setting('user') + ssh_user_key = self.context.get_setting('ssh-user-key') + if ssh_user_key: + os.mkdir('%s/home/%s/.ssh' % (self.context.chroot_dir, user), 0700) + shutil.copy(ssh_user_key, '%s/home/%s/.ssh/authorized_keys' % (self.context.chroot_dir, user)) + os.chmod('%s/home/%s/.ssh/authorized_keys' % (self.context.chroot_dir, user), 0644) + self.run_in_target('chown', '-R', '%s:%s' % ((user,)*2), '/home/%s/.ssh/' % (user)) + + if ssh_user_key or ssh_key: + addpkg = self.context.get_setting('addpkg') + addpkg += ['openssh-server'] + self.context.set_setting('addpkg', addpkg) + + def mount_dev_proc(self): + run_cmd('mount', '--bind', '/dev', '%s/dev' % self.context.chroot_dir) + self.context.add_clean_cb(self.unmount_dev) + + run_cmd('mount', '--bind', '/dev/pts', '%s/dev/pts' % self.context.chroot_dir) + self.context.add_clean_cb(self.unmount_dev_pts) + + self.run_in_target('mount', '-t', 'proc', 'proc', '/proc') + self.context.add_clean_cb(self.unmount_proc) + + def unmount_proc(self): + self.context.cancel_cleanup(self.unmount_proc) + run_cmd('umount', '%s/proc' % self.context.chroot_dir) + + def unmount_dev_pts(self): + self.context.cancel_cleanup(self.unmount_dev_pts) + run_cmd('umount', '%s/dev/pts' % self.context.chroot_dir) + + def unmount_dev(self): + self.context.cancel_cleanup(self.unmount_dev) + run_cmd('umount', '%s/dev' % self.context.chroot_dir) + + def update_passwords(self): + # Set the user password, using md5 + user = self.context.get_setting('user') + passwd = self.context.get_setting('pass') + self.run_in_target(stdin=('%s:%s\n' % (user, passwd)), *self.chpasswd_cmd) + + # Lock root account only if we didn't set the root password + rootpass = self.context.get_setting('rootpass') + if rootpass: + self.run_in_target(stdin=('%s:%s\n' % ('root', rootpass)), *self.chpasswd_cmd) + else: + self.run_in_target('usermod', '-L', 'root') + + lock_user = self.context.get_setting('lock-user') + if lock_user: + logging.info('Locking %s' % (user, )) + self.run_in_target('usermod', '-L', user) + + def create_initial_user(self): + uid = self.context.get_setting('uid') + name = self.context.get_setting('name') + user = self.context.get_setting('user') + if uid: + self.run_in_target('adduser', '--disabled-password', '--uid', uid, '--gecos', name, user) + else: + self.run_in_target('adduser', '--disabled-password', '--gecos', name, user) + + self.run_in_target('addgroup', '--system', 'admin') + self.run_in_target('adduser', user, 'admin') + + self.install_from_template('/etc/sudoers', 'sudoers') + for group in ['adm', 'audio', 'cdrom', 'dialout', 'floppy', 'video', 'plugdev', 'dip', 'netdev', 'powerdev', 'lpadmin', 'scanner']: + self.run_in_target('adduser', user, group, ignore_fail=True) + + self.update_passwords() + + def kernel_name(self): + flavour = self.context.get_setting('flavour') + arch = self.context.get_setting('arch') + return 'linux-image-%s' % (flavour or self.default_flavour[arch],) + + def config_host_and_domainname(self): + hostname = self.context.get_setting('hostname') + domain = self.context.get_setting('domain') + self.context.install_file('/etc/hostname', hostname) + self.install_from_template('/etc/hosts', 'etc_hosts', { 'hostname' : hostname, 'domain' : domain }) + + def config_interfaces(self, nics): + self.install_from_template('/etc/network/interfaces', 'interfaces', + { 'ip' : nics[0].type == 'dhcp' and 'dhcp' or nics[0].ip, + 'mask' : nics[0].netmask, + 'net' : nics[0].network, + 'bcast' : nics[0].broadcast, + 'gw' : nics[0].gateway, + 'dns' : nics[0].dns, + 'domain' : self.context.get_setting('domain') }) + + def unprevent_daemons_starting(self): + os.unlink('%s/usr/sbin/policy-rc.d' % self.context.chroot_dir) + + def prevent_daemons_starting(self): + os.chmod(self.install_from_template('/usr/sbin/policy-rc.d', 'nostart-policy-rc.d'), 0755) + + def seed(self, seedfile): + """Seed debconf with the contents of a seedfile""" + logging.info('Seeding with "%s"' % seedfile) + + self.run_in_target('debconf-set-selections', stdin=open(seedfile, 'r').read()) + + def install_extras(self): + seedfile = self.context.get_setting('seedfile') + if seedfile: + self.seed(seedfile) + + addpkg = self.context.get_setting('addpkg') + removepkg = self.context.get_setting('removepkg') + if not addpkg and not removepkg: + return + + cmd = ['apt-get', 'install', '-y', '--force-yes'] + cmd += addpkg or [] + cmd += ['%s-' % pkg for pkg in removepkg or []] + self.run_in_target(env={ 'DEBIAN_FRONTEND' : 'noninteractive' }, *cmd) + + def unmount_volatile(self): + for mntpnt in glob.glob('%s/lib/modules/*/volatile' % self.context.chroot_dir): + logging.debug("Unmounting %s" % mntpnt) + run_cmd('sleep', '10') + run_cmd('umount', mntpnt) + + def install_menu_lst(self, disks): + self.run_in_target(self.updategrub, '-y') + self.mangle_grub_menu_lst(disks) + self.run_in_target(self.updategrub) + self.run_in_target('grub-set-default', '0') + + def mangle_grub_menu_lst(self, disks): + rootdev = disk.rootpart(disks) + bootdev = disk.bootpart(disks) + run_cmd('sed', '-ie', 's/^# kopt=root=\([^ ]*\)\(.*\)/# kopt=root=UUID=%s rw/g' % rootdev.fs.uuid, '%s/boot/grub/menu.lst' % self.context.chroot_dir) + run_cmd('sed', '-ie', 's/^# groot.*/# groot=(hd0,0)/g', '%s/boot/grub/menu.lst' % self.context.chroot_dir) + run_cmd('sed', '-ie', '/^# kopt_2_6/ d', '%s/boot/grub/menu.lst' % self.context.chroot_dir) + + def install_sources_list(self, final=False): + if final: + mirror = updates_mirror = self.context.get_setting('mirror') + security_mirror = self.context.get_setting('security-mirror') + else: + mirror, updates_mirror, security_mirror = self.install_mirrors() + + components = self.context.get_setting('components') + suite = self.context.get_setting('suite') + self.install_from_template('/etc/apt/sources.list', 'sources.list', { 'mirror' : mirror, + 'security_mirror' : security_mirror, + 'updates_mirror' : updates_mirror, + 'components' : components, + 'suite' : suite }) + + # If setting up the final mirror, allow apt-get update to fail + # (since we might be on a complete different network than the + # final vm is going to be on). + self.run_in_target('apt-get', 'update', ignore_fail=final) + + def install_apt_proxy(self): + proxy = self.context.get_setting('proxy') + if proxy is not None: + self.context.install_file('/etc/apt/apt.conf', '// Proxy added by vmbuilder\nAcquire::http { Proxy "%s"; };' % proxy) + + def fstab(self): + retval = '''# /etc/fstab: static file system information. +# +# +proc /proc proc defaults 0 0 +''' + parts = disk.get_ordered_partitions(self.context.disks) + for part in parts: + retval += "UUID=%-40s %15s %7s %15s %d %d\n" % (part.fs.uuid, part.fs.mntpnt, part.fs.fstab_fstype(), part.fs.fstab_options(), 0, 0) + return retval + + def install_device_map(self): + self.install_from_template('/boot/grub/device.map', 'devicemap', { 'prefix' : self.disk_prefix }) + + def debootstrap(self): + arch = self.context.get_setting('arch') + cmd = ['/usr/sbin/debootstrap', '--arch=%s' % arch] + + variant = self.context.get_setting('variant') + if variant: + cmd += ['--variant=%s' % variant] + + debootstrap_tarball = self.context.get_setting('debootstrap-tarball') + if debootstrap_tarball: + cmd += ['--unpack-tarball=%s' % debootstrap_tarball] + + suite = self.context.get_setting('suite') + cmd += [suite, self.context.chroot_dir, self.debootstrap_mirror()] + kwargs = { 'env' : { 'DEBIAN_FRONTEND' : 'noninteractive' } } + + proxy = self.context.get_setting('proxy') + if proxy: + kwargs['env']['http_proxy'] = proxy + run_cmd(*cmd, **kwargs) + + def debootstrap_mirror(self): + iso = self.context.get_setting('iso') + if iso: + isodir = tempfile.mkdtemp() + self.context.add_clean_cb(lambda:os.rmdir(isodir)) + run_cmd('mount', '-o', 'loop', '-t', 'iso9660', iso, isodir) + self.context.add_clean_cmd('umount', isodir) + self.iso_mounted = True + + return 'file://%s' % isodir + else: + return self.install_mirrors()[0] + + + def install_mirrors(self): + install_mirror = self.context.get_setting('install-mirror') + if install_mirror: + mirror = install_mirror + else: + mirror = self.context.get_setting('mirror') + + updates_mirror = mirror + + install_security_mirror = self.context.get_setting('install-security-mirror') + if install_security_mirror: + security_mirror = install_security_mirror + else: + security_mirror = self.context.get_setting('security-mirror') + + return (mirror, updates_mirror, security_mirror) + + def install_kernel(self, destdir): + run_cmd('chroot', destdir, 'apt-get', '--force-yes', '-y', 'install', self.kernel_name(), env={ 'DEBIAN_FRONTEND' : 'noninteractive' }) + + def install_grub(self, chroot_dir): + self.install_from_template('/etc/kernel-img.conf', 'kernelimg', { 'updategrub' : self.updategrub }) + arch = self.context.get_setting('arch') + self.run_in_target('apt-get', '--force-yes', '-y', 'install', 'grub', env={ 'DEBIAN_FRONTEND' : 'noninteractive' }) + run_cmd('rsync', '-a', '%s%s/%s/' % (chroot_dir, self.grubroot, arch == 'amd64' and 'x86_64-pc' or 'i386-pc'), '%s/boot/grub/' % chroot_dir) + + def create_devices(self): + pass +# FIXME +# import VMBuilder.plugins.xen + +# if isinstance(self.context.hypervisor, VMBuilder.plugins.xen.Xen): +# self.run_in_target('mknod', '/dev/xvda', 'b', '202', '0') +# self.run_in_target('mknod', '/dev/xvda1', 'b', '202', '1') +# self.run_in_target('mknod', '/dev/xvda2', 'b', '202', '2') +# self.run_in_target('mknod', '/dev/xvda3', 'b', '202', '3') +# self.run_in_target('mknod', '/dev/xvc0', 'c', '204', '191') + + def install_from_template(self, *args, **kwargs): + return self.context.install_from_template(*args, **kwargs) + + def run_in_target(self, *args, **kwargs): + return self.context.run_in_target(*args, **kwargs) + + def copy_to_target(self, infile, destpath): + logging.debug("Copying %s on host to %s in guest" % (infile, destpath)) + dir = '%s/%s' % (self.destdir, os.path.dirname(destpath)) + if not os.path.isdir(dir): + os.makedirs(dir) + if os.path.isdir(infile): + shutil.copytree(infile, '%s/%s' % (self.destdir, destpath)) + else: + shutil.copy(infile, '%s/%s' % (self.destdir, destpath)) + + def post_mount(self, fs): + if fs.mntpnt == '/': + logging.debug("Creating /var/run in root filesystem") + os.makedirs('%s/var/run' % fs.mntpath) + logging.debug("Creating /var/lock in root filesystem") + os.makedirs('%s/var/lock' % fs.mntpath) + + def set_locale(self): + lang = self.context.get_setting('lang') + if lang: + self.install_from_template('/etc/default/locale', 'locale', { 'lang' : lang }) + if lang != "C": + self.run_in_target('locale-gen', lang) + self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'libc6') + self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'locales') + + def install_vmbuilder_log(self, logfile, rootdir): + shutil.copy(logfile, '%s/var/log/vmbuilder-install.log' % (rootdir,)) + + def set_timezone(self): + timezone = self.context.get_setting('timezone') + if timezone: + self.install_from_template('/etc/timezone', 'timezone', { 'timezone' : timezone }) + self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'locales') + + def install_ec2(self): + if self.context.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() + + def has_256_bit_inode_ext3_support(self): + return False + diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/sarge.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/sarge.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/sarge.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/sarge.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2007-2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.debian.woody import Woody + +class Sarge(Woody): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/squeeze.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/squeeze.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/squeeze.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/squeeze.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2007-2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.debian.lenny import Lenny + +class Squeeze(Lenny): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/stretch.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/stretch.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/stretch.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/stretch.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2007-2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.debian.jessie import Jessie + +class Stretch(Jessie): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/suite.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/suite.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/suite.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/suite.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,28 @@ +# +# Uncomplicated VM Builder +# 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +class Suite(object): + def __init__(self, context): + self.context = context + self.isodir = '/media/vmbuilder_inst_image' + self.iso_mounted = False + + def check_arch_validity(self, arch): + """Checks whether the given arch is valid for this suite""" + raise NotImplemented('Suite subclasses need to implement the check_arch_validity method') diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/devicemap.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/devicemap.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/devicemap.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/devicemap.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,3 @@ +#for $disk in $disks +$disk.get_grub_id() /dev/$prefix$disk.devletters() +#end for diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/etc_hosts.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/etc_hosts.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/etc_hosts.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/etc_hosts.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,10 @@ +127.0.0.1 localhost +127.0.1.1 $hostname.$domain $hostname + +# The following lines are desirable for IPv6 capable hosts +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +ff02::3 ip6-allhosts diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/initctl-stub.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/initctl-stub.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/initctl-stub.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/initctl-stub.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,3 @@ +#!/bin/sh +echo +echo "Warning: Fake initctl called, doing nothing" diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/interfaces.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/interfaces.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/interfaces.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/interfaces.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,22 @@ +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +# The loopback network interface +auto lo +iface lo inet loopback + +# The primary network interface +auto eth0 +#if $ip == 'dhcp' +iface eth0 inet dhcp +#else +iface eth0 inet static + address $ip + netmask $mask + network $net + broadcast $bcast + gateway $gw + # dns-* options are implemented by the resolvconf package, if installed + dns-nameservers $dns + dns-search $domain +#end if diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/is-compat-env.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/is-compat-env.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/is-compat-env.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/is-compat-env.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,3 @@ +# this is read by ec2-is-compat-env to determine if this is an +# ec2 compatible environment +compat=1 diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/kernelimg.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/kernelimg.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/kernelimg.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/kernelimg.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,8 @@ +do_symlinks = yes +relative_links = yes +do_bootfloppy = no +do_initrd = yes +link_in_boot = no +postinst_hook = $updategrub +postrm_hook = $updategrub +do_bootloader = no diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/locale.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/locale.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/locale.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/locale.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1 @@ +LANG="$lang" diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/nostart-policy-rc.d.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/nostart-policy-rc.d.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/nostart-policy-rc.d.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/nostart-policy-rc.d.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,18 @@ +#!/bin/sh + +while true; do + case "$1" in + -*) + shift + ;; + makedev) + exit 0 + ;; + x11-common) + exit 0 + ;; + *) + exit 101 + ;; + esac +done diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/sources.list.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/sources.list.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/sources.list.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/sources.list.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,8 @@ +deb $mirror $suite #slurp +#echo ' '.join($components) + +deb $updates_mirror $suite-updates #slurp +#echo ' '.join($components) + +deb $security_mirror $suite/updates #slurp +#echo ' '.join($components) diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/sudoers.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/sudoers.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/sudoers.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/sudoers.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# /etc/sudoers +# +# This file MUST be edited with the 'visudo' command as root. +# +# See the man page for details on how to write a sudoers file. +# Defaults + +Defaults !lecture,tty_tickets,!fqdn + +# Uncomment to allow members of group sudo to not need a password +# %sudo ALL=NOPASSWD: ALL + +# Host alias specification + +# User alias specification + +# Cmnd alias specification + +# User privilege specification +root ALL=(ALL) ALL + +# Members of the admin group may gain root privileges +%admin ALL=(ALL) ALL diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/timezone.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/timezone.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/timezone.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/timezone.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1 @@ +$timezone diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/upstart.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/upstart.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/upstart.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/upstart.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,16 @@ +# $console - getty +# +# This service maintains a getty on $console from the point the system is +# started until it is shut down again. + +start on stopped rc2 +start on stopped rc3 +start on stopped rc4 +start on stopped rc5 + +stop on runlevel 0 +stop on runlevel 1 +stop on runlevel 6 + +respawn +exec /sbin/getty 38400 $console diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/xen-ld-so-conf.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/xen-ld-so-conf.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/templates/xen-ld-so-conf.tmpl 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/templates/xen-ld-so-conf.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1 @@ +hwcap 0 nosegneg diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/wheezy.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/wheezy.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/wheezy.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/wheezy.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2007-2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.debian.squeeze import Squeeze + +class Wheezy(Squeeze): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/woody.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/woody.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/debian/woody.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/debian/woody.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2007-2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.debian.potato import Potato + +class Woody(Potato): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/libvirt/templates/libvirtxml.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/libvirt/templates/libvirtxml.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/libvirt/templates/libvirtxml.tmpl 2010-12-02 08:14:16.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/libvirt/templates/libvirtxml.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -20,12 +20,10 @@ #else -#if $mac - -#end if -#if $network #end if +#if $mac + #end if #if $virtio_net diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/dapper.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/dapper.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/dapper.py 2010-12-02 08:15:01.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/dapper.py 2017-12-20 08:43:22.000000000 +0000 @@ -72,8 +72,8 @@ self.call_hook('fix_ownership', manifest) def update(self): - self.run_in_target('apt-get', '-y', '--force-yes', 'dist-upgrade', - env={ 'DEBIAN_FRONTEND' : 'noninteractive' }) + self.run_in_target('apt-get', '-y', '--force-yes', '--option=Dpkg::Options::=--force-confnew', + 'dist-upgrade', env={ 'DEBIAN_FRONTEND' : 'noninteractive' }) def install_authorized_keys(self): ssh_key = self.context.get_setting('ssh-key') @@ -246,7 +246,7 @@ self.context.install_file('/etc/apt/apt.conf', '// Proxy added by vmbuilder\nAcquire::http { Proxy "%s"; };' % proxy) def install_fstab(self, disks, filesystems): - self.install_from_template('/etc/fstab', 'dapper_fstab', { 'parts' : disk.get_ordered_partitions(disks), 'prefix' : self.disk_prefix }) + self.install_from_template('/etc/fstab', 'dapper_fstab', { 'parts' : disk.get_ordered_partitions(disks) }) def install_device_map(self): self.install_from_template('/boot/grub/device.map', 'devicemap', { 'prefix' : self.disk_prefix }) @@ -259,6 +259,10 @@ if variant: cmd += ['--variant=%s' % variant] + debootstrap_tarball = self.context.get_setting('debootstrap-tarball') + if debootstrap_tarball: + cmd += ['--unpack-tarball=%s' % debootstrap_tarball] + suite = self.context.get_setting('suite') cmd += [suite, self.context.chroot_dir, self.debootstrap_mirror()] kwargs = { 'env' : { 'DEBIAN_FRONTEND' : 'noninteractive' } } diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/distro.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/distro.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/distro.py 2011-10-19 19:12:45.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/distro.py 2017-12-20 03:14:21.000000000 +0000 @@ -1,6 +1,6 @@ # # Uncomplicated VM Builder -# Copyright (C) 2007-2010 Canonical Ltd. +# Copyright (C) 2007-2015 Canonical Ltd. # # See AUTHORS for list of contributors # @@ -30,7 +30,9 @@ arg = 'ubuntu' suites = ['dapper', 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', 'maverick', 'natty', 'oneiric', - 'precise' ] + 'precise', 'quantal', 'raring', 'saucy', 'trusty', + 'utopic', 'vivid', 'wily', 'xenial', + ] # Maps host arch to valid guest archs valid_archs = { 'amd64' : ['amd64', 'i386', 'lpia' ], @@ -54,6 +56,7 @@ group.add_setting('suite', default='lucid', help='Suite to install. Valid options: %s [default: %%default]' % ' '.join(self.suites)) group.add_setting('flavour', extra_args=['--kernel-flavour'], help='Kernel flavour to use. Default and valid options depend on architecture and suite') group.add_setting('variant', metavar='VARIANT', help='Passed to debootstrap --variant flag; use minbase, buildd, or fakechroot.') + group.add_setting('debootstrap-tarball', metavar='FILE', help='Passed to debootstrap --unpack-tarball flag.') group.add_setting('iso', metavar='PATH', help='Use an iso image as the source for installation of file. Full path to the iso must be provided. If --mirror is also provided, it will be used in the final sources.list of the vm. This requires suite and kernel parameter to match what is available on the iso, obviously.') group.add_setting('mirror', metavar='URL', help='Use Ubuntu mirror at URL instead of the default, which is http://archive.ubuntu.com/ubuntu for official arches and http://ports.ubuntu.com/ubuntu-ports otherwise') group.add_setting('proxy', metavar='URL', help='Use proxy at URL for cached packages') @@ -137,8 +140,8 @@ self.suite.pre_install() def configure_os(self): - self.suite.install_sources_list() self.suite.install_apt_proxy() + self.suite.install_sources_list() self.suite.create_devices() self.suite.prevent_daemons_starting() self.suite.mount_dev_proc() diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/edgy.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/edgy.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/edgy.py 2010-12-02 08:15:01.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/edgy.py 2017-12-20 03:14:21.000000000 +0000 @@ -72,13 +72,20 @@ self.install_from_template('/etc/timezone', 'timezone', { 'timezone' : timezone }) self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'tzdata') + def divert_file(self, path, add): + full_path = '%s/%s' % (self.context.chroot_dir, path) + renamed_path = '%s.real' % (full_path, ) + if add: (src, dst) = full_path, renamed_path + else: (src, dst) = renamed_path, full_path + os.rename(src, dst) + def prevent_daemons_starting(self): super(Edgy, self).prevent_daemons_starting() - initctl = '%s/sbin/initctl' % (self.context.chroot_dir,) - os.rename(initctl, '%s.REAL' % (initctl,)) + initctl = '/sbin/initctl' + self.divert_file(initctl, True) self.install_from_template('/sbin/initctl', 'initctl-stub', mode=0755) def unprevent_daemons_starting(self): super(Edgy, self).unprevent_daemons_starting() - initctl = '%s/sbin/initctl' % (self.context.chroot_dir,) - os.rename('%s.REAL' % (initctl,), initctl) + initctl = '/sbin/initctl' + self.divert_file(initctl, False) diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/hardy.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/hardy.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/hardy.py 2010-02-24 15:49:04.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/hardy.py 2017-12-20 03:14:21.000000000 +0000 @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +import time from VMBuilder.plugins.ubuntu.gutsy import Gutsy class Hardy(Gutsy): @@ -56,3 +57,9 @@ def has_256_bit_inode_ext3_support(self): return True + + def unmount_dev(self): + # no idea why, but something keep /dev busy briefly during the + # bootstrap + time.sleep(1) + super(Hardy, self).unmount_dev() diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/lucid.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/lucid.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/lucid.py 2010-02-24 15:49:04.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/lucid.py 2017-12-20 03:14:21.000000000 +0000 @@ -16,8 +16,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +import os +from VMBuilder.util import run_cmd from VMBuilder.plugins.ubuntu.karmic import Karmic class Lucid(Karmic): valid_flavours = { 'i386' : ['386', 'generic', 'generic-pae', 'virtual'], 'amd64' : ['generic', 'preempt', 'server', 'virtual'] } + + def divert_file(self, path, add): + if add: action = "--add" + else: action = "--remove" + if not add: + os.remove('%s/%s' % (self.context.chroot_dir, path)) + run_cmd('chroot', self.context.chroot_dir, 'dpkg-divert', '--local', '--rename', action, path) diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/oneiric.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/oneiric.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/oneiric.py 2011-08-17 12:09:07.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/oneiric.py 2017-12-20 03:14:21.000000000 +0000 @@ -16,13 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -import time from VMBuilder.plugins.ubuntu.natty import Natty class Oneiric(Natty): - - def unmount_dev(self): - # no idea why, but something keep /dev busy briefly during the - # bootstrap - time.sleep(1) - super(Oneiric, self).unmount_dev() + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/quantal.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/quantal.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/quantal.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/quantal.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.ubuntu.precise import Precise + +class Quantal(Precise): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/raring.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/raring.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/raring.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/raring.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.ubuntu.quantal import Quantal + +class Raring(Quantal): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/saucy.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/saucy.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/saucy.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/saucy.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.ubuntu.raring import Raring + +class Saucy(Raring): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/templates/dapper_fstab.tmpl vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/templates/dapper_fstab.tmpl --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/templates/dapper_fstab.tmpl 2010-02-24 11:04:23.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/templates/dapper_fstab.tmpl 2017-12-20 03:14:21.000000000 +0000 @@ -3,8 +3,5 @@ # proc /proc proc defaults 0 0 #for $part in $parts -#echo '/dev/%s%-40s %-15s %-7s %-15s %d %d\n' % ($prefix, part.get_suffix(), part.mntpnt, part.fs.fstab_fstype(), part.fs.fstab_options(), 0, 0) -#* -echo "/dev/$prefix$part.get_suffix() $part.mntpnt $part.fs.fstab_fstype() $part.fs.fstab_options() 0 0 -*# +UUID=$part.fs.uuid $part.mntpnt $part.fs.fstab_fstype() $part.fs.fstab_options() 0 0 #end for diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/trusty.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/trusty.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/trusty.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/trusty.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2010 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.ubuntu.saucy import Saucy + +class Trusty(Saucy): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/utopic.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/utopic.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/utopic.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/utopic.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2010-2015 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.ubuntu.trusty import Trusty + +class Utopic(Trusty): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/vivid.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/vivid.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/vivid.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/vivid.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2010-2015 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.ubuntu.utopic import Utopic + +class Vivid(Utopic): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/wily.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/wily.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/wily.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/wily.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2010-2015 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.ubuntu.vivid import Vivid + +class Wily(Vivid): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/xenial.py vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/xenial.py --- vm-builder-0.12.4+bzr477/VMBuilder/plugins/ubuntu/xenial.py 1970-01-01 00:00:00.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/plugins/ubuntu/xenial.py 2017-12-20 03:14:21.000000000 +0000 @@ -0,0 +1,23 @@ +# +# Uncomplicated VM Builder +# Copyright (C) 2010-2015 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 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import time +from VMBuilder.plugins.ubuntu.wily import Wily + +class Xenial(Wily): + pass diff -Nru vm-builder-0.12.4+bzr477/VMBuilder/util.py vm-builder-0.12.4+bzr494/VMBuilder/util.py --- vm-builder-0.12.4+bzr477/VMBuilder/util.py 2010-06-10 17:20:58.000000000 +0000 +++ vm-builder-0.12.4+bzr494/VMBuilder/util.py 2017-12-20 03:14:21.000000000 +0000 @@ -155,18 +155,22 @@ logging.debug('(args=%r, kwargs=%r)' % (args, kwargs)) for plugin in context.plugins: logging.debug('Calling %s method in %s plugin.' % (func, plugin.__module__)) - getattr(plugin, func, log_no_such_method)(*args, **kwargs) + try: + getattr(plugin, func)(*args, **kwargs) + except AttributeError as e: + logging.debug('No such method ({}) in context plugin ({})'.format( + func, plugin.__module__)) for f in context.hooks.get(func, []): logging.debug('Calling %r.' % (f,)) f(*args, **kwargs) logging.debug('Calling %s method in context plugin %s.' % (func, context.__module__)) - getattr(context, func, log_no_such_method)(*args, **kwargs) - -def log_no_such_method(*args, **kwargs): - logging.debug('No such method') - return + try: + getattr(context, func)(*args, **kwargs) + except AttributeError as e: + logging.debug('No such method ({}) in context plugin ({})'.format( + func, plugin.__module__)) def tmp_filename(suffix='', tmp_root=None): # There is a risk in using tempfile.mktemp(): it's not recommended