Merge lp://qastaging/~bzed/vmbuilder/debian into lp://qastaging/vmbuilder/trunk

Proposed by Bernd Zeimetz
Status: Needs review
Proposed branch: lp://qastaging/~bzed/vmbuilder/debian
Merge into: lp://qastaging/vmbuilder/trunk
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~bzed/vmbuilder/debian
Reviewer Review Type Date Requested Status
Soren Hansen Pending
Review via email: mp+7084@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Bernd Zeimetz (bzed) wrote :

I've added support for Debian Etch and fixed a lot of other bugs while doing so. Lenny and testing/unstable will follow soon. Had to start with Etch as I needed it for a customer...

338. By Bernd Zeimetz

Additional verbosity for template usagefor debugging.

339. By Bernd Zeimetz

Debian doesn't have a lpia arch - it was left in one help output.

340. By Bernd Zeimetz

Another template fix for virtualbox.

341. By Bernd Zeimetz

Older suite need 128 bit inode for grub to recognize os - see r250 for details.
Fixing this for etch, too.

342. By Bernd Zeimetz

Adding xen flavour for etch.

343. By Bernd Zeimetz

os_type must be Linux for virtualbox.
There doesn't seem to be a way to set it flavour on the commandline.

344. By Bernd Zeimetz

Adding missing copyright.

345. By Bernd Zeimetz

Merging trunk changes.

Unmerged revisions

345. By Bernd Zeimetz

Merging trunk changes.

344. By Bernd Zeimetz

Adding missing copyright.

343. By Bernd Zeimetz

os_type must be Linux for virtualbox.
There doesn't seem to be a way to set it flavour on the commandline.

342. By Bernd Zeimetz

Adding xen flavour for etch.

341. By Bernd Zeimetz

Older suite need 128 bit inode for grub to recognize os - see r250 for details.
Fixing this for etch, too.

340. By Bernd Zeimetz

Another template fix for virtualbox.

339. By Bernd Zeimetz

Debian doesn't have a lpia arch - it was left in one help output.

338. By Bernd Zeimetz

Additional verbosity for template usagefor debugging.

337. By Bernd Zeimetz

Add missing import os.

336. By Bernd Zeimetz

More fixes for the virtualbox deploy skript template.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'AUTHORS'
--- AUTHORS 2008-09-29 12:28:03 +0000
+++ AUTHORS 2009-06-02 10:32:00 +0000
@@ -2,3 +2,5 @@
22
3Other contributors:3Other contributors:
4 * Nicolas Barcet <nicolas.barcet@ubuntu.com>4 * Nicolas Barcet <nicolas.barcet@ubuntu.com>
5 * Bernd Zeimetz <bzed@debian.org>
6
5\ No newline at end of file7\ No newline at end of file
68
=== modified file 'VMBuilder/__init__.py'
--- VMBuilder/__init__.py 2008-08-29 22:14:45 +0000
+++ VMBuilder/__init__.py 2009-06-04 12:22:50 +0000
@@ -21,10 +21,9 @@
21# The publically exposed bits of VMBuilder21# The publically exposed bits of VMBuilder
22#22#
23import logging23import logging
24import VMBuilder.plugins24from VMBuilder.plugins import load_plugins, Plugin
25from VMBuilder.distro import Distro25from VMBuilder.distro import Distro
26from VMBuilder.hypervisor import Hypervisor26from VMBuilder.hypervisor import Hypervisor
27from VMBuilder.plugins import Plugin
28from VMBuilder.frontend import Frontend27from VMBuilder.frontend import Frontend
29from VMBuilder.vm import VM28from VMBuilder.vm import VM
30from VMBuilder.exception import VMBuilderException, VMBuilderUserError29from VMBuilder.exception import VMBuilderException, VMBuilderUserError
@@ -66,4 +65,4 @@
66 frontend.run()65 frontend.run()
6766
68logging.debug('Loading plugins')67logging.debug('Loading plugins')
69VMBuilder.plugins.load_plugins()68load_plugins()
7069
=== modified file 'VMBuilder/frontend.py'
--- VMBuilder/frontend.py 2008-08-29 22:14:45 +0000
+++ VMBuilder/frontend.py 2009-06-04 00:42:28 +0000
@@ -18,22 +18,20 @@
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
20# Frontend interface and classes20# Frontend interface and classes
2121from VMBuilder.exception import VMBuilderException
22import VMBuilder
23import optparse
2422
25class Frontend(object):23class Frontend(object):
26 def __init__(self):24 def __init__(self):
27 self.settings = []25 self.settings = []
2826
29 def setting_group(self, help=None):27 def setting_group(self, setting_help=None):
30 return self.SettingsGroup(help)28 return self.SettingsGroup(setting_help)
31 29
32 def add_setting_group(self, group):30 def add_setting_group(self, group):
33 self.settings.append(group)31 self.settings.append(group)
3432
35 def add_setting(self, **kwargs):33 def add_setting(self, **kwargs):
36 self.settings.append(Setting(**kwargs))34 self.settings.append(self.Setting(**kwargs))
3735
38 setting_types = ['store', 'store']36 setting_types = ['store', 'store']
39 class Setting(object):37 class Setting(object):
@@ -42,8 +40,8 @@
42 self.longarg = kwargs.get('shortarg', None)40 self.longarg = kwargs.get('shortarg', None)
43 self.default = kwargs.get('default', None)41 self.default = kwargs.get('default', None)
44 self.help = kwargs.get('help', None)42 self.help = kwargs.get('help', None)
45 type = kwargs.get('type', 'store')43 store_type = kwargs.get('type', 'store')
46 if type not in setting_types:44 if store_type not in Frontend.setting_types:
47 raise VMBuilderException("Invalid option type: %s" % type)45 raise VMBuilderException("Invalid option type: %s" % type)
4846
49 class SettingsGroup(Setting):47 class SettingsGroup(Setting):
5048
=== modified file 'VMBuilder/hypervisor.py'
--- VMBuilder/hypervisor.py 2008-08-29 22:14:45 +0000
+++ VMBuilder/hypervisor.py 2009-06-04 12:23:59 +0000
@@ -19,12 +19,12 @@
19#19#
20# Hypervisor super class20# Hypervisor super class
2121
22import VMBuilder.plugins22from VMBuilder import Plugin
2323
24STORAGE_DISK_IMAGE = 024STORAGE_DISK_IMAGE = 0
25STORAGE_FS_IMAGE = 125STORAGE_FS_IMAGE = 1
2626
27class Hypervisor(VMBuilder.plugins.Plugin):27class Hypervisor(Plugin):
28 def finalize(self):28 def finalize(self):
29 raise NotImplemented('Hypervisor subclasses need to implement the finalize method')29 raise NotImplemented('Hypervisor subclasses need to implement the finalize method')
3030
3131
=== modified file 'VMBuilder/plugins/__init__.py'
--- VMBuilder/plugins/__init__.py 2008-12-11 17:37:29 +0000
+++ VMBuilder/plugins/__init__.py 2009-06-03 22:31:00 +0000
@@ -20,6 +20,7 @@
20import os20import os
21import VMBuilder21import VMBuilder
22from VMBuilder.util import run_cmd22from VMBuilder.util import run_cmd
23from VMBuilder.exception import VMBuilderException
2324
24def load_plugins():25def load_plugins():
25 for plugin in find_plugins():26 for plugin in find_plugins():
2627
=== modified file 'VMBuilder/plugins/cli/__init__.py'
--- VMBuilder/plugins/cli/__init__.py 2009-05-04 13:08:30 +0000
+++ VMBuilder/plugins/cli/__init__.py 2009-06-04 11:36:56 +0000
@@ -1,5 +1,6 @@
1# Uncomplicated VM Builder1# Uncomplicated VM Builder
2# Copyright (C) 2007-2008 Canonical Ltd.2# Copyright (C) 2007-2008 Canonical Ltd.
3# Copyright (C) 2009 Bernd Zeimetz <bzed@debian.org>
3# 4#
4# See AUTHORS for list of contributors5# See AUTHORS for list of contributors
5#6#
@@ -24,13 +25,12 @@
24import textwrap25import textwrap
25import VMBuilder26import VMBuilder
26from VMBuilder.disk import parse_size27from VMBuilder.disk import parse_size
27import VMBuilder.hypervisor
28_ = gettext28_ = gettext
2929
3030
31class CLI(VMBuilder.Frontend):31class CLI(VMBuilder.Frontend):
32 arg = 'cli'32 arg = 'cli'
33 33
34 def run(self):34 def run(self):
35 try:35 try:
36 next = False36 next = False
@@ -52,7 +52,7 @@
52 self.set_usage(vm)52 self.set_usage(vm)
5353
54 vm.optparser.disable_interspersed_args()54 vm.optparser.disable_interspersed_args()
55 (foo, args) = vm.optparser.parse_args()55 args = vm.optparser.parse_args()[1]
56 self.handle_args(vm, args)56 self.handle_args(vm, args)
57 vm.optparser.enable_interspersed_args()57 vm.optparser.enable_interspersed_args()
5858
@@ -93,7 +93,7 @@
93 vm.add_filesystem(size='%dM' % vm.rootsize, type='ext3', mntpnt='/')93 vm.add_filesystem(size='%dM' % vm.rootsize, type='ext3', mntpnt='/')
94 vm.add_filesystem(size='%dM' % vm.swapsize, type='swap', mntpnt=None)94 vm.add_filesystem(size='%dM' % vm.swapsize, type='swap', mntpnt=None)
95 if vm.optsize > 0:95 if vm.optsize > 0:
96 vm.add_filesystem(size='%dM' % optsize, type='ext3', mntpnt='/opt')96 vm.add_filesystem(size='%dM' % vm.optsize, type='ext3', mntpnt='/opt')
97 else:97 else:
98 if vm.raw:98 if vm.raw:
99 disk = vm.add_disk(filename=vm.raw, preallocated=True)99 disk = vm.add_disk(filename=vm.raw, preallocated=True)
@@ -161,22 +161,38 @@
161 disk.add_part(offset, int(pair[1]), 'ext3', pair[0])161 disk.add_part(offset, int(pair[1]), 'ext3', pair[0])
162 offset += int(pair[1])162 offset += int(pair[1])
163163
164class UVB(CLI):164class VB(CLI):
165 arg = 'ubuntu-vm-builder'165 arg = 'vb'
166 suites = []
167 distro = ''
166168
167 def set_usage(self, vm):169 def set_usage(self, vm):
168 vm.optparser.set_usage('%prog hypervisor suite [options]')170 vm.optparser.set_usage('%prog hypervisor suite [options]')
169 vm.optparser.arg_help = (('hypervisor', vm.hypervisor_help), ('suite', self.suite_help))171 vm.optparser.arg_help = (('hypervisor', vm.hypervisor_help), ('suite', self.suite_help))
170172
171 def suite_help(self):173 def suite_help(self):
172 return 'Suite. Valid options: %s' % " ".join(VMBuilder.plugins.ubuntu.distro.Ubuntu.suites)174 return 'Suite. Valid options: %s' % " ".join(self.suites)
173175
174 def handle_args(self, vm, args):176 def handle_args(self, vm, args):
175 if len(args) < 2:177 if len(args) < 2:
176 vm.optparser.error("You need to specify at least the hypervisor type and the suite")178 vm.optparser.error("You need to specify at least the hypervisor type and the suite")
177 vm.set_hypervisor(args[0])179 vm.set_hypervisor(args[0])
178 vm.set_distro('ubuntu')180 vm.set_distro(self.distro)
179 vm.suite = args[1]181 vm.suite = args[1]
180 182
183class UVB(VB):
184 arg = 'ubuntu-vm-builder'
185 import VMBuilder.plugins.ubuntu as ubuntu
186 suites = ubuntu.distro.Ubuntu.suites
187 distro = 'ubuntu'
188
189class DVB(VB):
190 arg = 'debian-vm-builder'
191 import VMBuilder.plugins.debian as debian
192 suites = debian.distro.Debian.suites
193 distro = 'debian'
194
195
181VMBuilder.register_frontend(CLI)196VMBuilder.register_frontend(CLI)
182VMBuilder.register_frontend(UVB)197VMBuilder.register_frontend(UVB)
198VMBuilder.register_frontend(DVB)
183199
=== added directory 'VMBuilder/plugins/debian'
=== added file 'VMBuilder/plugins/debian/__init__.py'
--- VMBuilder/plugins/debian/__init__.py 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/__init__.py 2009-06-02 12:04:26 +0000
@@ -0,0 +1,21 @@
1#
2# Uncomplicated VM Builder
3# Copyright (C) 2007-2008 Canonical Ltd.
4# Copyright (C) 2009 Bernd Zeimetz <bzed@debian.org>
5#
6# See AUTHORS for list of contributors
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21import distro
022
=== added file 'VMBuilder/plugins/debian/distro.py'
--- VMBuilder/plugins/debian/distro.py 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/distro.py 2009-06-03 09:40:36 +0000
@@ -0,0 +1,195 @@
1#
2# Uncomplicated VM Builder
3# Copyright (C) 2007-2008 Canonical Ltd.
4# Copyright (C) 2009 Bernd Zeimetz <bzed@debian.org>
5#
6# See AUTHORS for list of contributors
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21import logging
22import os
23import socket
24import types
25import VMBuilder
26from VMBuilder import register_distro, Distro
27from VMBuilder.util import run_cmd
28from VMBuilder.exception import VMBuilderUserError, VMBuilderException
29
30class Debian(Distro):
31 name = 'Debian'
32 arg = 'debian'
33 suites = ['etch']
34
35 # Maps host arch to valid guest archs
36 # FIXME: Running a amd64 kernel with an i386 userspace allows us to run
37 # amd64 guests
38
39 valid_archs = { 'amd64' : ['amd64', 'i386' ],
40 'i386' : [ 'i386' ] }
41
42 xen_kernel = ''
43
44 def register_options(self):
45 group = self.vm.setting_group('Package options')
46 group.add_option('--addpkg', action='append', metavar='PKG', help='Install PKG into the guest (can be specfied multiple times).')
47 group.add_option('--removepkg', action='append', metavar='PKG', help='Remove PKG from the guest (can be specfied multiple times)')
48 self.vm.register_setting_group(group)
49
50 group = self.vm.setting_group('General OS options')
51 self.host_arch = run_cmd('dpkg', '--print-architecture').rstrip()
52 group.add_option('-a', '--arch', default=self.host_arch, help='Specify the target architecture. Valid options: amd64 i386 lpia (defaults to host arch)')
53 group.add_option('--hostname', default='debian', help='Set NAME as the hostname of the guest. Default: debian. Also uses this name as the VM name.')
54 self.vm.register_setting_group(group)
55
56 # FIXME: Add Debian ports
57 group = self.vm.setting_group('Installation options')
58 group.add_option('--suite', default='etch', help='Suite to install. Valid options: %s [default: %%default]' % ' '.join(self.suites))
59 group.add_option('--flavour', '--kernel-flavour', help='Kernel flavour to use. Default and valid options depend on architecture and suite')
60 group.add_option('--variant', metavar='VARIANT', help='Passed to debootstrap --variant flag; use minbase, buildd, or fakechroot.')
61 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.')
62 group.add_option('--mirror', metavar='URL', help='Use Debian mirror at URL instead of the default, which is http://ftp.debian.org for official arches.')
63 group.add_option('--proxy', metavar='URL', help='Use proxy at URL for cached packages')
64 group.add_option('--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')
65 group.add_option('--security-mirror', metavar='URL', help='Use Debian security mirror at URL instead of the default, which is http://security.debian.org/debian-security/ for official arches.')
66 group.add_option('--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')
67 group.add_option('--components', metavar='COMPS', help='A comma seperated list of distro components to include (e.g. main,contrib,non-free).')
68 group.add_option('--lang', metavar='LANG', default=self.get_locale(), help='Set the locale to LANG [default: %default]')
69 self.vm.register_setting_group(group)
70
71 group = self.vm.setting_group('Settings for the initial user')
72 group.add_option('--user', default='debian', help='Username of initial user [default: %default]')
73 group.add_option('--name', default='Debian', help='Full name of initial user [default: %default]')
74 group.add_option('--pass', default='debian', help='Password of initial user [default: %default]')
75 group.add_option('--rootpass', help='Initial root password (WARNING: this has strong security implications).')
76 self.vm.register_setting_group(group)
77
78 group = self.vm.setting_group('Other options')
79 group.add_option('--ssh-key', metavar='PATH', help='Add PATH to root\'s ~/.ssh/authorized_keys (WARNING: this has strong security implications).')
80 group.add_option('--ssh-user-key', help='Add PATH to the user\'s ~/.ssh/authorized_keys.')
81 self.vm.register_setting_group(group)
82
83 def set_defaults(self):
84 if not self.vm.mirror:
85 #if self.vm.arch == 'lpia':
86 # self.vm.mirror = 'http://ports.ubuntu.com/ubuntu-ports'
87 #else:
88 self.vm.mirror = 'http://ftp.debian.org/debian'
89
90 if not self.vm.security_mirror:
91 #if self.vm.arch == 'lpia':
92 # self.vm.security_mirror = 'http://ports.ubuntu.com/ubuntu-ports'
93 #else:
94 self.vm.security_mirror = 'http://security.debian.org/debian-security'
95
96 if not self.vm.components:
97 self.vm.components = ['main']
98 else:
99 self.vm.components = self.vm.components.split(',')
100
101 def get_locale(self):
102 return os.getenv('LANG')
103
104 def preflight_check(self):
105 """While not all of these are strictly checks, their failure would inevitably
106 lead to failure, and since we can check them before we start setting up disk
107 and whatnot, we might as well go ahead an do this now."""
108
109 if not self.vm.suite in self.suites:
110 raise VMBuilderUserError('Invalid suite. Valid suites are: %s' % ' '.join(self.suites))
111
112 modname = 'VMBuilder.plugins.debian.%s' % (self.vm.suite, )
113 mod = __import__(modname, fromlist=[self.vm.suite])
114 self.suite = getattr(mod, self.vm.suite.capitalize())(self.vm)
115
116 if self.vm.arch not in self.valid_archs[self.host_arch] or \
117 not self.suite.check_arch_validity(self.vm.arch):
118 raise VMBuilderUserError('%s is not a valid architecture. Valid architectures are: %s' % (self.vm.arch,
119 ' '.join(self.valid_archs[self.host_arch])))
120
121 if not self.vm.components:
122 self.vm.components = ['main', 'restricted', 'universe']
123 else:
124 if type(self.vm.components) is str:
125 self.vm.components = self.vm.components.split(',')
126
127 if self.vm.hypervisor.name == 'Xen':
128 logging.info('Xen kernel default: linux-image-%s %s', self.suite.xen_kernel_flavour, self.xen_kernel_version())
129
130 self.vm.virtio_net = self.use_virtio_net()
131
132 if self.vm.lang:
133 try:
134 run_cmd('locale-gen', '%s' % self.vm.lang)
135 except VMBuilderException, e:
136 msg = "locale-gen does not recognize your locale '%s'" % self.vm.lang
137 raise VMBuilderUserError(msg)
138
139 def install(self, destdir):
140 self.destdir = destdir
141 self.suite.install(destdir)
142
143 def install_vmbuilder_log(self, logfile, rootdir):
144 self.suite.install_vmbuilder_log(logfile, rootdir)
145
146 def post_mount(self, fs):
147 self.suite.post_mount(fs)
148
149 def use_virtio_net(self):
150 return self.suite.virtio_net
151
152 def install_bootloader(self):
153 devmapfile = '%s/device.map' % self.vm.workdir
154 devmap = open(devmapfile, 'w')
155 for (disk, id) in zip(self.vm.disks, range(len(self.vm.disks))):
156 devmap.write("(hd%d) %s\n" % (id, disk.filename))
157 devmap.close()
158 run_cmd('grub', '--device-map=%s' % devmapfile, '--batch', stdin='''root (hd0,0)
159setup (hd0)
160EOT''')
161
162 def xen_kernel_version(self):
163 if self.suite.xen_kernel_flavour:
164 if not self.xen_kernel:
165 rmad = run_cmd('rmadison', 'linux-image-%s' % self.suite.xen_kernel_flavour)
166 version = ['0', '0','0', '0']
167
168 for line in rmad.splitlines():
169 sline = line.split('|')
170
171 if sline[2].strip().startswith(self.vm.suite):
172 vt = sline[1].strip().split('.')
173 for i in range(4):
174 if int(vt[i]) > int(version[i]):
175 version = vt
176 break
177
178 if version[0] == '0':
179 raise VMBuilderException('Something is wrong, no valid xen kernel for the suite %s found by rmadison' % self.vm.suite)
180
181 self.xen_kernel = '%s.%s.%s-%s' % (version[0],version[1],version[2],version[3])
182 return self.xen_kernel
183 else:
184 raise VMBuilderUserError('There is no valid xen kernel for the suite selected.')
185
186 def xen_kernel_path(self):
187 path = '/boot/vmlinuz-%s-%s' % (self.xen_kernel_version(), self.suite.xen_kernel_flavour)
188 return path
189
190 def xen_ramdisk_path(self):
191 path = '/boot/initrd.img-%s-%s' % (self.xen_kernel_version(), self.suite.xen_kernel_flavour)
192 return path
193
194
195register_distro(Debian)
0196
=== added file 'VMBuilder/plugins/debian/etch.py'
--- VMBuilder/plugins/debian/etch.py 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/etch.py 2009-06-04 13:21:36 +0000
@@ -0,0 +1,342 @@
1#
2# Uncomplicated VM Builder
3# Copyright (C) 2007-2008 Canonical Ltd.
4# Copyright (C) 2009 Bernd Zeimetz <bzed@debian.org>
5#
6# See AUTHORS for list of contributors
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21import glob
22import logging
23import os
24import shutil
25import socket
26import tempfile
27import VMBuilder
28import VMBuilder.disk as disk
29import VMBuilder.suite as suite
30from VMBuilder.util import run_cmd
31
32class Etch(suite.Suite):
33 updategrub = "/usr/sbin/update-grub"
34 grubroot = "/usr/lib/grub"
35
36 valid_flavours = { 'i386' : ['486', '686', '686-bigmem',
37 '686-bigmem-etchnhalf', '686-etchnhalf',
38 '686-smp', 'vserver-686'],
39 'amd64' : ['amd64', 'amd64-etchnhalf', 'amd64-generic',
40 'amd64-k8', 'amd64-k8-smp', 'vserver-amd64',
41 'vserver-amd64-k8-smp']}
42
43 default_flavour = { 'i386' : '686-etchnhalf', 'amd64' : 'amd64-etchnhalf' }
44 disk_prefix = 'sd'
45 xen_kernel_flavour = None
46 virtio_net = False
47
48 def check_kernel_flavour(self, arch, flavour):
49 return flavour in self.valid_flavours[arch]
50
51 def check_arch_validity(self, arch):
52 return arch in self.valid_flavours.keys()
53
54 def install(self, destdir):
55 self.destdir = destdir
56
57 logging.debug("debootstrapping")
58 self.debootstrap()
59
60 logging.debug("Setting up sources.list")
61 self.install_sources_list()
62
63 logging.debug("Setting up apt proxy")
64 self.install_apt_proxy()
65
66 logging.debug("Installing fstab")
67 self.install_fstab()
68
69 logging.debug("Creating devices")
70 self.create_devices()
71
72 if self.vm.hypervisor.needs_bootloader:
73 logging.debug("Installing grub")
74 self.install_grub()
75
76 logging.debug("Configuring guest networking")
77 self.config_network()
78
79 logging.debug("Preventing daemons from starting")
80 self.prevent_daemons_starting()
81
82 if self.vm.hypervisor.needs_bootloader:
83 logging.debug("Installing menu.list")
84 self.install_menu_lst()
85
86 logging.debug("Installing kernel")
87 self.install_kernel()
88
89 logging.debug("Creating device.map")
90 self.install_device_map()
91
92 logging.debug("Installing extra packages")
93 self.install_extras()
94
95 logging.debug("Creating initial user")
96 self.create_initial_user()
97
98 logging.debug("Installing ssh keys")
99 self.install_authorized_keys()
100
101 logging.debug("Installing locales")
102 self.install_locales()
103
104 logging.debug("Copy host settings")
105 self.copy_settings()
106
107 logging.debug("Making sure system is up-to-date")
108 self.update()
109
110 logging.debug("Setting up final sources.list")
111 self.install_sources_list(final=True)
112
113 logging.debug("Unmounting volatile lrm filesystems")
114 self.unmount_volatile()
115
116 logging.debug("Unpreventing daemons from starting")
117 self.unprevent_daemons_starting()
118
119 def update(self):
120 self.run_in_target('apt-get', '-y', '--force-yes', 'dist-upgrade',
121 env={ 'DEBIAN_FRONTEND' : 'noninteractive' })
122
123 def install_authorized_keys(self):
124 if self.vm.ssh_key:
125 os.mkdir('%s/root/.ssh' % self.destdir, 0700)
126 shutil.copy(self.vm.ssh_key, '%s/root/.ssh/authorized_keys' % self.destdir)
127 os.chmod('%s/root/.ssh/authorized_keys' % self.destdir, 0644)
128 if self.vm.ssh_user_key:
129 os.mkdir('%s/home/%s/.ssh' % (self.destdir, self.vm.user), 0700)
130 shutil.copy(self.vm.ssh_user_key, '%s/home/%s/.ssh/authorized_keys' % (self.destdir, self.vm.user))
131 os.chmod('%s/home/%s/.ssh/authorized_keys' % (self.destdir, self.vm.user), 0644)
132 self.run_in_target('chown', '-R', '%s:%s' % (self.vm.user,)*2, '/home/%s/.ssh/' % (self.vm.user))
133
134 if self.vm.ssh_user_key or self.vm.ssh_key:
135 if not self.vm.addpkg:
136 self.vm.addpkg = []
137 self.vm.addpkg += ['openssh-server']
138
139 def update_passwords(self):
140 # Set the user password, using md5
141 self.run_in_target('chpasswd', '-m', stdin=('%s:%s\n' % (self.vm.user, getattr(self.vm, 'pass'))))
142
143 # Lock root account only if we didn't set the root password
144 if self.vm.rootpass:
145 self.run_in_target('chpasswd', '-m', stdin=('%s:%s\n' % ('root', self.vm.rootpass)))
146 else:
147 self.run_in_target('chpasswd', '-e', stdin='root:!\n')
148
149 def create_initial_user(self):
150 self.run_in_target('adduser', '--disabled-password', '--gecos', self.vm.name, self.vm.user)
151 self.run_in_target('addgroup', '--system', 'admin')
152 self.run_in_target('adduser', self.vm.user, 'admin')
153
154 self.install_from_template('/etc/sudoers', 'sudoers')
155 for group in ['adm', 'audio', 'cdrom', 'dialout', 'floppy', 'video', 'plugdev', 'dip', 'netdev', 'powerdev', 'lpadmin', 'scanner']:
156 self.run_in_target('adduser', self.vm.user, group, ignore_fail=True)
157
158 self.update_passwords()
159
160 def kernel_name(self):
161 return 'linux-image-2.6-%s' % (self.vm.flavour or self.default_flavour[self.vm.arch],)
162
163 def config_network(self):
164 self.vm.install_file('/etc/hostname', self.vm.hostname)
165 self.install_from_template('/etc/hosts', 'etc_hosts', { 'hostname' : self.vm.hostname, 'domain' : self.vm.domain })
166 self.install_from_template('/etc/network/interfaces', 'interfaces')
167
168 def unprevent_daemons_starting(self):
169 os.unlink('%s/usr/sbin/policy-rc.d' % self.destdir)
170
171 def prevent_daemons_starting(self):
172 os.chmod(self.install_from_template('/usr/sbin/policy-rc.d', 'nostart-policy-rc.d'), 0755)
173
174 def install_extras(self):
175 if not self.vm.addpkg and not self.vm.removepkg:
176 return
177 cmd = ['apt-get', 'install', '-y', '--force-yes']
178 cmd += self.vm.addpkg or []
179 cmd += ['%s-' % pkg for pkg in self.vm.removepkg or []]
180 self.run_in_target(env={ 'DEBIAN_FRONTEND' : 'noninteractive' }, *cmd)
181
182 def unmount_volatile(self):
183 for mntpnt in glob.glob('%s/lib/modules/*/volatile' % self.destdir):
184 logging.debug("Unmounting %s" % mntpnt)
185 run_cmd('umount', mntpnt)
186
187 def install_menu_lst(self):
188 run_cmd('mount', '--bind', '/dev', '%s/dev' % self.destdir)
189 self.vm.add_clean_cmd('umount', '%s/dev' % self.destdir, ignore_fail=True)
190
191 self.run_in_target('mount', '-t', 'proc', 'proc', '/proc')
192 self.vm.add_clean_cmd('umount', '%s/proc' % self.destdir, ignore_fail=True)
193
194 self.run_in_target(self.updategrub, '-y')
195 self.mangle_grub_menu_lst()
196 self.run_in_target(self.updategrub)
197 self.run_in_target('grub-set-default', '0')
198
199 run_cmd('umount', '%s/dev' % self.destdir)
200 run_cmd('umount', '%s/proc' % self.destdir)
201
202 def mangle_grub_menu_lst(self):
203 bootdev = disk.bootpart(self.vm.disks)
204 run_cmd('sed', '-ie', 's/^# kopt=root=\([^ ]*\)\(.*\)/# kopt=root=UUID=%s\\2/g' % bootdev.fs.uuid, '%s/boot/grub/menu.lst' % self.destdir)
205 run_cmd('sed', '-ie', 's/^# groot.*/# groot %s/g' % bootdev.get_grub_id(), '%s/boot/grub/menu.lst' % self.destdir)
206 run_cmd('sed', '-ie', '/^# kopt_2_6/ d', '%s/boot/grub/menu.lst' % self.destdir)
207
208 def install_sources_list(self, final=False):
209 if final:
210 mirror, updates_mirror, security_mirror = self.vm.mirror, self.vm.mirror, self.vm.security_mirror
211 else:
212 mirror, updates_mirror, security_mirror = self.install_mirrors()
213
214 self.install_from_template('/etc/apt/sources.list', 'sources.list', { 'mirror' : mirror, 'security_mirror' : security_mirror, 'updates_mirror' : updates_mirror })
215
216 # If setting up the final mirror, allow apt-get update to fail
217 # (since we might be on a complete different network than the
218 # final vm is going to be on).
219 self.run_in_target('apt-get', 'update', ignore_fail=final)
220
221 def install_apt_proxy(self):
222 if self.vm.proxy is not None:
223 self.vm.install_file('/etc/apt/apt.conf', '// Proxy added by vmbuilder\nAcquire::http { Proxy "%s"; };' % self.vm.proxy)
224
225 def install_fstab(self):
226 if self.vm.hypervisor.preferred_storage == VMBuilder.hypervisor.STORAGE_FS_IMAGE:
227 self.install_from_template('/etc/fstab', 'etch_fstab_fsimage', { 'fss' : disk.get_ordered_filesystems(self.vm), 'prefix' : self.disk_prefix })
228 else:
229 self.install_from_template('/etc/fstab', 'etch_fstab', { 'parts' : disk.get_ordered_partitions(self.vm.disks), 'prefix' : self.disk_prefix })
230
231 def install_device_map(self):
232 self.install_from_template('/boot/grub/device.map', 'devicemap', { 'prefix' : self.disk_prefix })
233
234 def debootstrap(self):
235 cmd = ['/usr/sbin/debootstrap', '--arch=%s' % self.vm.arch]
236 if self.vm.variant:
237 cmd += ['--variant=%s' % self.vm.variant]
238 cmd += [self.vm.suite, self.destdir, self.debootstrap_mirror()]
239 kwargs = { 'env' : { 'DEBIAN_FRONTEND' : 'noninteractive' } }
240 if self.vm.proxy:
241 kwargs['env']['http_proxy'] = self.vm.proxy
242 run_cmd(*cmd, **kwargs)
243
244 def debootstrap_mirror(self):
245 if self.vm.iso:
246 isodir = tempfile.mkdtemp()
247 self.vm.add_clean_cb(lambda:os.rmdir(isodir))
248 run_cmd('mount', '-o', 'loop', '-t', 'iso9660', self.vm.iso, isodir)
249 self.vm.add_clean_cmd('umount', isodir)
250 self.iso_mounted = True
251
252 return 'file://%s' % isodir
253 else:
254 return self.install_mirrors()[0]
255
256
257 def install_mirrors(self):
258 if self.vm.iso:
259 mirror = "file:///isomnt"
260 elif self.vm.install_mirror:
261 mirror = self.vm.install_mirror
262 else:
263 mirror = self.vm.mirror
264
265 if self.vm.install_mirror:
266 updates_mirror = self.vm.install_mirror
267 else:
268 updates_mirror = self.vm.mirror
269
270 if self.vm.install_security_mirror:
271 security_mirror = self.vm.install_security_mirror
272 else:
273 security_mirror = self.vm.security_mirror
274
275 return (mirror, updates_mirror, security_mirror)
276
277 def install_kernel(self):
278 self.install_from_template('/etc/kernel-img.conf', 'kernelimg', { 'updategrub' : self.updategrub })
279 run_cmd('chroot', self.destdir, 'apt-get', '--force-yes', '-y', 'install', self.kernel_name(), 'grub')
280
281 def install_grub(self):
282 self.run_in_target('apt-get', '--force-yes', '-y', 'install', 'grub')
283 run_cmd('cp', '-a', '%s%s/%s/' % (self.destdir, self.grubroot, self.vm.arch == 'amd64' and 'x86_64-pc' or 'i386-pc'), '%s/boot/grub' % self.destdir)
284
285
286 def install_locales(self):
287 self.run_in_target('apt-get', '--force-yes', '-y', 'install', 'locales')
288
289 def create_devices(self):
290 import VMBuilder.plugins.xen
291
292 if isinstance(self.vm.hypervisor, VMBuilder.plugins.xen.Xen):
293 self.run_in_target('mknod', '/dev/xvda', 'b', '202', '0')
294 self.run_in_target('mknod', '/dev/xvda1', 'b', '202', '1')
295 self.run_in_target('mknod', '/dev/xvda2', 'b', '202', '2')
296 self.run_in_target('mknod', '/dev/xvda3', 'b', '202', '3')
297 self.run_in_target('mknod', '/dev/xvc0', 'c', '204', '191')
298
299 def install_from_template(self, *args, **kwargs):
300 return self.vm.distro.install_from_template(*args, **kwargs)
301
302 def run_in_target(self, *args, **kwargs):
303 self.vm.distro.run_in_target(*args, **kwargs)
304
305 def copy_to_target(self, infile, destpath):
306 logging.debug("Copying %s on host to %s in guest" % (infile, destpath))
307 dir = '%s/%s' % (self.destdir, os.path.dirname(destpath))
308 if not os.path.isdir(dir):
309 os.makedirs(dir)
310 if os.path.isdir(infile):
311 shutil.copytree(infile, '%s/%s' % (self.destdir, destpath))
312 else:
313 shutil.copy(infile, '%s/%s' % (self.destdir, destpath))
314
315 def post_mount(self, fs):
316 if fs.mntpnt == '/':
317 logging.debug("Creating /var/run in root filesystem")
318 os.makedirs('%s/var/run' % fs.mntpath)
319 logging.debug("Creating /var/lock in root filesystem")
320 os.makedirs('%s/var/lock' % fs.mntpath)
321
322
323 def copy_settings(self):
324 self.copy_to_target('/etc/default/locale', '/etc/default/locale')
325 csdir = '%s/etc/console-setup' % self.destdir
326 have_cs = os.path.isdir(csdir)
327 if have_cs:
328 shutil.rmtree(csdir)
329 self.copy_to_target('/etc/console-setup', '/etc/console-setup')
330 self.copy_to_target('/etc/default/console-setup', '/etc/default/console-setup')
331 self.copy_to_target('/etc/timezone', '/etc/timezone')
332 self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'tzdata')
333 self.run_in_target('locale-gen', 'en_US.UTF-8')
334 if self.vm.lang:
335 self.run_in_target('locale-gen', self.vm.lang)
336 self.install_from_template('/etc/default/locale', 'locale', { 'lang' : self.vm.lang })
337 self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'locales')
338 if have_cs:
339 self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'console-setup')
340
341 def install_vmbuilder_log(self, logfile, rootdir):
342 shutil.copy(logfile, '%s/var/log/vmbuilder-install.log' % (rootdir,))
0343
=== added directory 'VMBuilder/plugins/debian/templates'
=== added file 'VMBuilder/plugins/debian/templates/devicemap.tmpl'
--- VMBuilder/plugins/debian/templates/devicemap.tmpl 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/templates/devicemap.tmpl 2009-06-02 11:01:44 +0000
@@ -0,0 +1,3 @@
1#for $disk in $disks
2$disk.get_grub_id() /dev/$prefix$disk.devletters()
3#end for
04
=== added file 'VMBuilder/plugins/debian/templates/etc_hosts.tmpl'
--- VMBuilder/plugins/debian/templates/etc_hosts.tmpl 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/templates/etc_hosts.tmpl 2009-06-02 11:01:44 +0000
@@ -0,0 +1,10 @@
1127.0.0.1 localhost
2127.0.1.1 $hostname.$domain $hostname
3
4# The following lines are desirable for IPv6 capable hosts
5::1 ip6-localhost ip6-loopback
6fe00::0 ip6-localnet
7ff00::0 ip6-mcastprefix
8ff02::1 ip6-allnodes
9ff02::2 ip6-allrouters
10ff02::3 ip6-allhosts
011
=== added file 'VMBuilder/plugins/debian/templates/etch_fstab.tmpl'
--- VMBuilder/plugins/debian/templates/etch_fstab.tmpl 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/templates/etch_fstab.tmpl 2009-06-02 11:03:02 +0000
@@ -0,0 +1,10 @@
1# /etc/fstab: static file system information.
2#
3# <file system> <mount point> <type> <options> <dump> <pass>
4proc /proc proc defaults 0 0
5#for $part in $parts
6#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)
7#*
8echo "/dev/$prefix$part.get_suffix() $part.mntpnt $part.fs.fstab_fstype() $part.fs.fstab_options() 0 0
9*#
10#end for
011
=== added file 'VMBuilder/plugins/debian/templates/etch_fstab_fsimage.tmpl'
--- VMBuilder/plugins/debian/templates/etch_fstab_fsimage.tmpl 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/templates/etch_fstab_fsimage.tmpl 2009-06-02 11:03:02 +0000
@@ -0,0 +1,10 @@
1# /etc/fstab: static file system information.
2#
3# <file system> <mount point> <type> <options> <dump> <pass>
4proc /proc proc defaults 0 0
5#for $fs in $fss
6#echo '/dev/%s%-40s %-15s %-7s %-15s %d %d\n' % ($prefix, fs.get_suffix(), fs.mntpnt, fs.fstab_fstype(), fs.fstab_options(), 0, 0)
7#*
8echo "/dev/$prefix$part.get_suffix() $part.mntpnt $part.fs.fstab_fstype() $part.fs.fstab_options() 0 0
9*#
10#end for
011
=== added file 'VMBuilder/plugins/debian/templates/interfaces.tmpl'
--- VMBuilder/plugins/debian/templates/interfaces.tmpl 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/templates/interfaces.tmpl 2009-06-02 11:01:44 +0000
@@ -0,0 +1,22 @@
1# This file describes the network interfaces available on your system
2# and how to activate them. For more information, see interfaces(5).
3
4# The loopback network interface
5auto lo
6iface lo inet loopback
7
8# The primary network interface
9auto eth0
10#if $ip == 'dhcp'
11iface eth0 inet dhcp
12#else
13iface eth0 inet static
14 address $ip
15 netmask $mask
16 network $net
17 broadcast $bcast
18 gateway $gw
19 # dns-* options are implemented by the resolvconf package, if installed
20 dns-nameservers $dns
21 dns-search $domain
22#end if
023
=== added file 'VMBuilder/plugins/debian/templates/kernelimg.tmpl'
--- VMBuilder/plugins/debian/templates/kernelimg.tmpl 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/templates/kernelimg.tmpl 2009-06-02 11:01:44 +0000
@@ -0,0 +1,8 @@
1do_symlinks = yes
2relative_links = yes
3do_bootfloppy = no
4do_initrd = yes
5link_in_boot = no
6postinst_hook = $updategrub
7postrm_hook = $updategrub
8do_bootloader = no
09
=== added file 'VMBuilder/plugins/debian/templates/locale.tmpl'
--- VMBuilder/plugins/debian/templates/locale.tmpl 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/templates/locale.tmpl 2009-06-02 11:01:44 +0000
@@ -0,0 +1,1 @@
1LANG="$lang"
02
=== added file 'VMBuilder/plugins/debian/templates/nostart-policy-rc.d.tmpl'
--- VMBuilder/plugins/debian/templates/nostart-policy-rc.d.tmpl 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/templates/nostart-policy-rc.d.tmpl 2009-06-02 11:01:44 +0000
@@ -0,0 +1,18 @@
1#!/bin/sh
2
3while true; do
4 case "$1" in
5 -*)
6 shift
7 ;;
8 makedev)
9 exit 0
10 ;;
11 x11-common)
12 exit 0
13 ;;
14 *)
15 exit 101
16 ;;
17 esac
18done
019
=== added file 'VMBuilder/plugins/debian/templates/sources.list.tmpl'
--- VMBuilder/plugins/debian/templates/sources.list.tmpl 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/templates/sources.list.tmpl 2009-06-04 12:26:50 +0000
@@ -0,0 +1,6 @@
1deb $mirror $suite #slurp
2#echo ' '.join($components)
3
4deb $security_mirror $suite/updates #slurp
5#echo ' '.join($components)
6
07
=== added file 'VMBuilder/plugins/debian/templates/sudoers.tmpl'
--- VMBuilder/plugins/debian/templates/sudoers.tmpl 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/debian/templates/sudoers.tmpl 2009-06-03 09:40:36 +0000
@@ -0,0 +1,33 @@
1# sudoers file.
2#
3# This file MUST be edited with the 'visudo' command as root.
4# Failure to use 'visudo' may result in syntax or file permission errors
5# that prevent sudo from running.
6#
7# See the sudoers man page for the details on how to write a sudoers file.
8#
9
10# Defaults syslog=auth, secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"
11
12# Host alias specification
13
14# User alias specification
15
16# Cmnd alias specification
17
18# Defaults specification
19
20# Runas alias specification
21
22# User privilege specification
23root ALL=(ALL) ALL
24
25# Uncomment to allow people in group wheel to run all commands
26# %wheel ALL=(ALL) ALL
27
28# Same thing without a password
29# %wheel ALL=(ALL) NOPASSWD: ALL
30
31# Samples
32# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
33# %users localhost=/sbin/shutdown -h now
034
=== modified file 'VMBuilder/plugins/ubuntu/dapper.py'
--- VMBuilder/plugins/ubuntu/dapper.py 2009-05-07 21:00:20 +0000
+++ VMBuilder/plugins/ubuntu/dapper.py 2009-06-02 10:32:59 +0000
@@ -20,12 +20,12 @@
20import glob20import glob
21import logging21import logging
22import os22import os
23import suite
24import shutil23import shutil
25import socket24import socket
26import tempfile25import tempfile
27import VMBuilder26import VMBuilder
28import VMBuilder.disk as disk27import VMBuilder.disk as disk
28import VMBuilder.suite as suite
29from VMBuilder.util import run_cmd29from VMBuilder.util import run_cmd
3030
31class Dapper(suite.Suite):31class Dapper(suite.Suite):
3232
=== modified file 'VMBuilder/plugins/ubuntu/edgy.py'
--- VMBuilder/plugins/ubuntu/edgy.py 2009-05-04 13:08:30 +0000
+++ VMBuilder/plugins/ubuntu/edgy.py 2009-06-02 10:32:59 +0000
@@ -18,10 +18,10 @@
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
20import logging20import logging
21import suite
22import shutil21import shutil
23import os22import os
24import VMBuilder.disk as disk23import VMBuilder.disk as disk
24import VMBuilder.suite as suite
25from VMBuilder.util import run_cmd25from VMBuilder.util import run_cmd
26from VMBuilder.plugins.ubuntu.dapper import Dapper26from VMBuilder.plugins.ubuntu.dapper import Dapper
2727
2828
=== modified file 'VMBuilder/plugins/ubuntu/feisty.py'
--- VMBuilder/plugins/ubuntu/feisty.py 2008-08-29 22:14:45 +0000
+++ VMBuilder/plugins/ubuntu/feisty.py 2009-06-02 10:32:59 +0000
@@ -18,8 +18,8 @@
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
20import logging20import logging
21import suite
22import VMBuilder.disk as disk21import VMBuilder.disk as disk
22import VMBuilder.suite as suite
23from VMBuilder.util import run_cmd23from VMBuilder.util import run_cmd
24from VMBuilder.plugins.ubuntu.edgy import Edgy24from VMBuilder.plugins.ubuntu.edgy import Edgy
2525
2626
=== modified file 'VMBuilder/plugins/ubuntu/gutsy.py'
--- VMBuilder/plugins/ubuntu/gutsy.py 2008-11-03 18:23:47 +0000
+++ VMBuilder/plugins/ubuntu/gutsy.py 2009-06-02 10:32:59 +0000
@@ -18,8 +18,8 @@
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
20import logging20import logging
21import suite
22import VMBuilder.disk as disk21import VMBuilder.disk as disk
22import VMBuilder.suite as suite
23from VMBuilder.util import run_cmd23from VMBuilder.util import run_cmd
24from VMBuilder.plugins.ubuntu.feisty import Feisty24from VMBuilder.plugins.ubuntu.feisty import Feisty
2525
2626
=== modified file 'VMBuilder/plugins/ubuntu/hardy.py'
--- VMBuilder/plugins/ubuntu/hardy.py 2008-11-06 15:36:18 +0000
+++ VMBuilder/plugins/ubuntu/hardy.py 2009-06-02 10:32:59 +0000
@@ -17,7 +17,7 @@
17# You should have received a copy of the GNU General Public License17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
20import suite20import VMBuilder.suite as suite
21from VMBuilder.plugins.ubuntu.gutsy import Gutsy21from VMBuilder.plugins.ubuntu.gutsy import Gutsy
2222
23class Hardy(Gutsy):23class Hardy(Gutsy):
2424
=== modified file 'VMBuilder/plugins/ubuntu/intrepid.py'
--- VMBuilder/plugins/ubuntu/intrepid.py 2009-02-17 14:39:16 +0000
+++ VMBuilder/plugins/ubuntu/intrepid.py 2009-06-02 10:32:59 +0000
@@ -17,9 +17,9 @@
17# You should have received a copy of the GNU General Public License17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
20import suite
21import logging20import logging
22import VMBuilder.disk as disk21import VMBuilder.disk as disk
22import VMBuilder.suite as suite
23from VMBuilder.util import run_cmd23from VMBuilder.util import run_cmd
24from VMBuilder.plugins.ubuntu.hardy import Hardy24from VMBuilder.plugins.ubuntu.hardy import Hardy
2525
2626
=== modified file 'VMBuilder/plugins/ubuntu/jaunty.py'
--- VMBuilder/plugins/ubuntu/jaunty.py 2009-05-07 21:00:20 +0000
+++ VMBuilder/plugins/ubuntu/jaunty.py 2009-06-02 10:32:59 +0000
@@ -17,9 +17,9 @@
17# You should have received a copy of the GNU General Public License17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
20import suite
21import logging20import logging
22import VMBuilder.disk as disk21import VMBuilder.disk as disk
22import VMBuilder.suite as suite
23from VMBuilder.util import run_cmd23from VMBuilder.util import run_cmd
24from VMBuilder.plugins.ubuntu.intrepid import Intrepid24from VMBuilder.plugins.ubuntu.intrepid import Intrepid
2525
2626
=== modified file 'VMBuilder/plugins/virtualbox/templates/vm_deploy_script.tmpl'
--- VMBuilder/plugins/virtualbox/templates/vm_deploy_script.tmpl 2009-04-25 14:45:26 +0000
+++ VMBuilder/plugins/virtualbox/templates/vm_deploy_script.tmpl 2009-06-04 23:13:01 +0000
@@ -12,12 +12,14 @@
1212
1313
14#if $os_type == "ubuntu"14#if $os_type == "ubuntu"
15os_type = "Ubuntu"15os_type="Ubuntu"
16#elif $os_type == "debian"
17os_type="Debian"
16#else18#else
17os_type = "Other"19os_type="Unknown"
18#end if20#end if
1921
20disk_path = "#echo os.path.abspath(os.path.dirname($vm_disks[0]))/"#22disk_path = "#echo os.path.abspath(os.path.dirname($vm_disks[0]))#/"
2123
2224
23VBoxManage createvm -name $vm_name -ostype \$os_type -register25VBoxManage createvm -name $vm_name -ostype \$os_type -register
@@ -54,7 +56,7 @@
54#end if56#end if
5557
56#if $ip58#if $ip
57#if $ip == dhcp59#if $ip == "dhcp"
58VBoxManage modifyvm $vm_name -nic1 nat60VBoxManage modifyvm $vm_name -nic1 nat
59#else61#else
60VBoxManage modifyvm $vm_name -nic1 intnet 62VBoxManage modifyvm $vm_name -nic1 intnet
6163
=== modified file 'VMBuilder/plugins/virtualbox/vm.py'
--- VMBuilder/plugins/virtualbox/vm.py 2009-05-05 08:21:10 +0000
+++ VMBuilder/plugins/virtualbox/vm.py 2009-06-04 23:13:42 +0000
@@ -19,14 +19,11 @@
19#19#
2020
21import os21import os
22import os.path
23import stat22import stat
24import VMBuilder
25from VMBuilder import register_hypervisor, Hypervisor, VMBuilderUserError
26from VMBuilder.disk import vbox_manager_path
27import VMBuilder.hypervisor23import VMBuilder.hypervisor
24from VMBuilder import register_hypervisor
2825
29class VirtualBox(Hypervisor):26class VirtualBox(VMBuilder.hypervisor.Hypervisor):
30 preferred_storage = VMBuilder.hypervisor.STORAGE_DISK_IMAGE27 preferred_storage = VMBuilder.hypervisor.STORAGE_DISK_IMAGE
31 needs_bootloader = True28 needs_bootloader = True
32 name = 'VirtualBox'29 name = 'VirtualBox'
3330
=== renamed file 'VMBuilder/plugins/ubuntu/suite.py' => 'VMBuilder/suite.py'
=== modified file 'VMBuilder/vm.py'
--- VMBuilder/vm.py 2009-05-07 14:09:08 +0000
+++ VMBuilder/vm.py 2009-06-04 01:11:24 +0000
@@ -301,7 +301,7 @@
301 if (ipclass > 0) and (ipclass <= 127):301 if (ipclass > 0) and (ipclass <= 127):
302 mask = 0xFF302 mask = 0xFF
303 elif (ipclass > 128) and (ipclass < 192):303 elif (ipclass > 128) and (ipclass < 192):
304 mask = OxFFFF304 mask = 0xFFFF
305 elif (ipclass < 224):305 elif (ipclass < 224):
306 mask = 0xFFFFFF306 mask = 0xFFFFFF
307 else:307 else:
308308
=== added file 'debian-vm-builder'
--- debian-vm-builder 1970-01-01 00:00:00 +0000
+++ debian-vm-builder 2009-06-03 14:54:47 +0000
@@ -0,0 +1,29 @@
1#!/usr/bin/python
2#
3# Uncomplicated VM Builder
4# Copyright (C) 2007-2008 Canonical Ltd.
5#
6# See AUTHORS for list of contributors
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21
22#import sys
23#import os
24#sys.path += [os.getcwd()]
25
26import VMBuilder
27
28VMBuilder.set_frontend('ubuntu-vm-builder')
29VMBuilder.run()
030
=== added file 'debian-vm-builder.1'
--- debian-vm-builder.1 1970-01-01 00:00:00 +0000
+++ debian-vm-builder.1 2009-06-03 14:54:47 +0000
@@ -0,0 +1,7 @@
1.TH DEBIAN-VM-BUILDER 1 "Jun 2009"
2.SH NAME
3debian-vm-builder \- builds virtual machines from the command line
4.SH DESCRIPTION
5debian-vm-builder is now a wrapper to vmbuilder (part of the python-vm-builder package) and is only maintained for compatibility wih previous scripts. Please see the vmbuilder man page for more information or run
6.B vmbuilder <hypervisor> <distro> --help
7for a full list of options.
08
=== modified file 'setup.py'
--- setup.py 2009-02-23 14:04:47 +0000
+++ setup.py 2009-06-03 20:46:16 +0000
@@ -1,3 +1,5 @@
1#!/usr/bin/python
2
1from distutils.core import setup3from distutils.core import setup
2import VMBuilder.plugins4import VMBuilder.plugins
3from glob import glob5from glob import glob

Subscribers

People subscribed via source and target branches

to status/vote changes: