Merge lp:~bart-jukie/vmbuilder/fixes into lp:vmbuilder/trunk
- fixes
- Merge into trunk
Proposed by
bartman
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~bart-jukie/vmbuilder/fixes |
Merge into: | lp:vmbuilder/trunk |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~bart-jukie/vmbuilder/fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Virtualisation team | Pending | ||
Review via email: mp+4042@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
bartman (bart-jukie) wrote : | # |
lp:~bart-jukie/vmbuilder/fixes
updated
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'VMBuilder/plugins/cli/__init__.py' | |||
2 | --- VMBuilder/plugins/cli/__init__.py 2008-11-27 17:20:39 +0000 | |||
3 | +++ VMBuilder/plugins/cli/__init__.py 2009-02-28 21:03:04 +0000 | |||
4 | @@ -80,6 +80,9 @@ | |||
5 | 80 | 80 | ||
6 | 81 | def set_disk_layout(self, vm): | 81 | def set_disk_layout(self, vm): |
7 | 82 | if not vm.part: | 82 | if not vm.part: |
8 | 83 | vm.rootsize = int(vm.rootsize) | ||
9 | 84 | vm.swapsize = int(vm.swapsize) | ||
10 | 85 | vm.optsize = int(vm.optsize) | ||
11 | 83 | if vm.hypervisor.preferred_storage == VMBuilder.hypervisor.STORAGE_FS_IMAGE: | 86 | if vm.hypervisor.preferred_storage == VMBuilder.hypervisor.STORAGE_FS_IMAGE: |
12 | 84 | vm.add_filesystem(size='%dM' % vm.rootsize, type='ext3', mntpnt='/') | 87 | vm.add_filesystem(size='%dM' % vm.rootsize, type='ext3', mntpnt='/') |
13 | 85 | vm.add_filesystem(size='%dM' % vm.swapsize, type='swap', mntpnt=None) | 88 | vm.add_filesystem(size='%dM' % vm.swapsize, type='swap', mntpnt=None) |
14 | 86 | 89 | ||
15 | === modified file 'VMBuilder/plugins/ubuntu/dapper.py' | |||
16 | --- VMBuilder/plugins/ubuntu/dapper.py 2008-12-16 15:29:50 +0000 | |||
17 | +++ VMBuilder/plugins/ubuntu/dapper.py 2009-02-28 22:47:37 +0000 | |||
18 | @@ -102,6 +102,9 @@ | |||
19 | 102 | logging.debug("Unpreventing daemons from starting") | 102 | logging.debug("Unpreventing daemons from starting") |
20 | 103 | self.unprevent_daemons_starting() | 103 | self.unprevent_daemons_starting() |
21 | 104 | 104 | ||
22 | 105 | logging.debug("Execute post install script") | ||
23 | 106 | self.post_install_script() | ||
24 | 107 | |||
25 | 105 | def update(self): | 108 | def update(self): |
26 | 106 | self.run_in_target('apt-get', '-y', '--force-yes', 'dist-upgrade') | 109 | self.run_in_target('apt-get', '-y', '--force-yes', 'dist-upgrade') |
27 | 107 | 110 | ||
28 | @@ -203,7 +206,10 @@ | |||
29 | 203 | self.install_from_template('/boot/grub/device.map', 'devicemap', { 'prefix' : self.disk_prefix }) | 206 | self.install_from_template('/boot/grub/device.map', 'devicemap', { 'prefix' : self.disk_prefix }) |
30 | 204 | 207 | ||
31 | 205 | def debootstrap(self): | 208 | def debootstrap(self): |
33 | 206 | cmd = ['/usr/sbin/debootstrap', '--arch=%s' % self.vm.arch, self.vm.suite, self.destdir, self.debootstrap_mirror()] | 209 | cmd = ['/usr/sbin/debootstrap', '--arch=%s' % self.vm.arch] |
34 | 210 | if self.vm.variant: | ||
35 | 211 | cmd += ['--variant=%s' % self.vm.variant] | ||
36 | 212 | cmd += [self.vm.suite, self.destdir, self.debootstrap_mirror()] | ||
37 | 207 | run_cmd(*cmd) | 213 | run_cmd(*cmd) |
38 | 208 | 214 | ||
39 | 209 | def debootstrap_mirror(self): | 215 | def debootstrap_mirror(self): |
40 | @@ -288,3 +294,9 @@ | |||
41 | 288 | self.run_in_target('locale-gen', self.vm.lang) | 294 | self.run_in_target('locale-gen', self.vm.lang) |
42 | 289 | self.install_from_template('/etc/default/locale', 'locale', { 'lang' : self.vm.lang }) | 295 | self.install_from_template('/etc/default/locale', 'locale', { 'lang' : self.vm.lang }) |
43 | 290 | self.run_in_target('dpkg-reconfigure', '-pcritical', 'locales') | 296 | self.run_in_target('dpkg-reconfigure', '-pcritical', 'locales') |
44 | 297 | |||
45 | 298 | def post_install_script(self): | ||
46 | 299 | if self.vm.post_install_script: | ||
47 | 300 | run_cmd(self.vm.post_install_script, self.destdir) | ||
48 | 301 | |||
49 | 302 | |||
50 | 291 | 303 | ||
51 | === modified file 'VMBuilder/plugins/ubuntu/distro.py' | |||
52 | --- VMBuilder/plugins/ubuntu/distro.py 2008-12-16 13:39:21 +0000 | |||
53 | +++ VMBuilder/plugins/ubuntu/distro.py 2009-02-28 22:47:37 +0000 | |||
54 | @@ -53,6 +53,7 @@ | |||
55 | 53 | group = self.vm.setting_group('Installation options') | 53 | group = self.vm.setting_group('Installation options') |
56 | 54 | group.add_option('--suite', default='jaunty', help='Suite to install. Valid options: %s [default: %%default]' % ' '.join(self.suites)) | 54 | group.add_option('--suite', default='jaunty', help='Suite to install. Valid options: %s [default: %%default]' % ' '.join(self.suites)) |
57 | 55 | group.add_option('--flavour', '--kernel-flavour', help='Kernel flavour to use. Default and valid options depend on architecture and suite') | 55 | group.add_option('--flavour', '--kernel-flavour', help='Kernel flavour to use. Default and valid options depend on architecture and suite') |
58 | 56 | group.add_option('--variant', metavar='VARIANT', help='Passed to debootstrap --variant flag; use minbase, buildd, or fakechroot.') | ||
59 | 56 | group.add_option('--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.') | 57 | group.add_option('--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.') |
60 | 57 | group.add_option('--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') | 58 | group.add_option('--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') |
61 | 58 | group.add_option('--install-mirror', metavar='URL', help='Use Ubuntu mirror at URL for the installation only. Apt\'s sources.list will still use default or URL set by --mirror') | 59 | group.add_option('--install-mirror', metavar='URL', help='Use Ubuntu mirror at URL for the installation only. Apt\'s sources.list will still use default or URL set by --mirror') |
62 | @@ -61,6 +62,7 @@ | |||
63 | 61 | group.add_option('--components', metavar='COMPS', help='A comma seperated list of distro components to include (e.g. main,universe).') | 62 | group.add_option('--components', metavar='COMPS', help='A comma seperated list of distro components to include (e.g. main,universe).') |
64 | 62 | group.add_option('--ppa', metavar='PPA', action='append', help='Add ppa belonging to PPA to the vm\'s sources.list.') | 63 | group.add_option('--ppa', metavar='PPA', action='append', help='Add ppa belonging to PPA to the vm\'s sources.list.') |
65 | 63 | group.add_option('--lang', metavar='LANG', default=self.get_locale(), help='Set the locale to LANG [default: %default]') | 64 | group.add_option('--lang', metavar='LANG', default=self.get_locale(), help='Set the locale to LANG [default: %default]') |
66 | 65 | group.add_option('--post-install-script', metavar='PATH', help='Run script to update the installed image; scritp is passed the install dir') | ||
67 | 64 | self.vm.register_setting_group(group) | 66 | self.vm.register_setting_group(group) |
68 | 65 | 67 | ||
69 | 66 | group = self.vm.setting_group('Settings for the initial user') | 68 | group = self.vm.setting_group('Settings for the initial user') |
70 | 67 | 69 | ||
71 | === modified file 'VMBuilder/plugins/ubuntu/edgy.py' | |||
72 | --- VMBuilder/plugins/ubuntu/edgy.py 2008-12-04 16:28:48 +0000 | |||
73 | +++ VMBuilder/plugins/ubuntu/edgy.py 2009-02-28 22:47:22 +0000 | |||
74 | @@ -20,6 +20,7 @@ | |||
75 | 20 | import logging | 20 | import logging |
76 | 21 | import suite | 21 | import suite |
77 | 22 | import shutil | 22 | import shutil |
78 | 23 | import os | ||
79 | 23 | import VMBuilder.disk as disk | 24 | import VMBuilder.disk as disk |
80 | 24 | from VMBuilder.util import run_cmd | 25 | from VMBuilder.util import run_cmd |
81 | 25 | from VMBuilder.plugins.ubuntu.dapper import Dapper | 26 | from VMBuilder.plugins.ubuntu.dapper import Dapper |
82 | @@ -49,9 +50,12 @@ | |||
83 | 49 | 50 | ||
84 | 50 | def copy_settings(self): | 51 | def copy_settings(self): |
85 | 51 | self.copy_to_target('/etc/default/locale', '/etc/default/locale') | 52 | self.copy_to_target('/etc/default/locale', '/etc/default/locale') |
89 | 52 | shutil.rmtree('%s/etc/console-setup' % self.destdir) | 53 | csdir = '%s/etc/console-setup' % self.destdir |
90 | 53 | self.copy_to_target('/etc/console-setup', '/etc/console-setup') | 54 | have_cs = os.path.isdir(csdir) |
91 | 54 | self.copy_to_target('/etc/default/console-setup', '/etc/default/console-setup') | 55 | if have_cs: |
92 | 56 | shutil.rmtree(csdir) | ||
93 | 57 | self.copy_to_target('/etc/console-setup', '/etc/console-setup') | ||
94 | 58 | self.copy_to_target('/etc/default/console-setup', '/etc/default/console-setup') | ||
95 | 55 | self.copy_to_target('/etc/timezone', '/etc/timezone') | 59 | self.copy_to_target('/etc/timezone', '/etc/timezone') |
96 | 56 | self.run_in_target('dpkg-reconfigure', '-pcritical', 'tzdata') | 60 | self.run_in_target('dpkg-reconfigure', '-pcritical', 'tzdata') |
97 | 57 | self.run_in_target('locale-gen', 'en_US') | 61 | self.run_in_target('locale-gen', 'en_US') |
98 | @@ -59,4 +63,5 @@ | |||
99 | 59 | self.run_in_target('locale-gen', self.vm.lang) | 63 | self.run_in_target('locale-gen', self.vm.lang) |
100 | 60 | self.install_from_template('/etc/default/locale', 'locale', { 'lang' : self.vm.lang }) | 64 | self.install_from_template('/etc/default/locale', 'locale', { 'lang' : self.vm.lang }) |
101 | 61 | self.run_in_target('dpkg-reconfigure', '-pcritical', 'locales') | 65 | self.run_in_target('dpkg-reconfigure', '-pcritical', 'locales') |
103 | 62 | self.run_in_target('dpkg-reconfigure', '-pcritical', 'console-setup') | 66 | if have_cs: |
104 | 67 | self.run_in_target('dpkg-reconfigure', '-pcritical', 'console-setup') | ||
105 | 63 | 68 | ||
106 | === modified file 'VMBuilder/vm.py' | |||
107 | --- VMBuilder/vm.py 2009-02-17 13:31:40 +0000 | |||
108 | +++ VMBuilder/vm.py 2009-02-28 21:36:54 +0000 | |||
109 | @@ -137,7 +137,7 @@ | |||
110 | 137 | self.register_setting('--in-place', action='store_true', default=False, help='Install directly into the filesystem images. This is needed if your $TMPDIR is nodev and/or nosuid, but will result in slightly larger file system images.') | 137 | self.register_setting('--in-place', action='store_true', default=False, help='Install directly into the filesystem images. This is needed if your $TMPDIR is nodev and/or nosuid, but will result in slightly larger file system images.') |
111 | 138 | self.register_setting('--tmpfs', metavar="OPTS", help='Use a tmpfs as the working directory, specifying its size or "-" to use tmpfs default (suid,dev,size=1G).') | 138 | self.register_setting('--tmpfs', metavar="OPTS", help='Use a tmpfs as the working directory, specifying its size or "-" to use tmpfs default (suid,dev,size=1G).') |
112 | 139 | self.register_setting('-m', '--mem', type='int', default=128, help='Assign MEM megabytes of memory to the guest vm. [default: %default]') | 139 | self.register_setting('-m', '--mem', type='int', default=128, help='Assign MEM megabytes of memory to the guest vm. [default: %default]') |
114 | 140 | self.register_setting('--cpus', type='int', default=1, help='Number of virtual CPU's. [default: %default]') | 140 | self.register_setting('--cpus', type='int', default=1, help='Number of virtual CPU\'s. [default: %default]') |
115 | 141 | 141 | ||
116 | 142 | group = self.setting_group('Network related options') | 142 | group = self.setting_group('Network related options') |
117 | 143 | domainname = '.'.join(socket.gethostbyname_ex(socket.gethostname())[0].split('.')[1:]) | 143 | domainname = '.'.join(socket.gethostbyname_ex(socket.gethostname())[0].split('.')[1:]) |
I have some misc patches for the python-vm-builder package. If you want me to fix anything up, let me know.
Summary: install- script to run a script right after the image is built, but before it's transfered to the disk image.
* added --post-
* added --variant to handle building a minbase debootstrap image.
* make sure rootsize, optsize and swapsize are integers.
* make it possible to install w/o console-steup.
* fix some build issues.