Merge lp://qastaging/~bzed/vmbuilder/debian into lp://qastaging/vmbuilder/trunk
- debian
- Merge into trunk
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 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Soren Hansen | Pending | ||
Review via email:
|
Commit message
Description of the change
- 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
1 | === modified file 'AUTHORS' | |||
2 | --- AUTHORS 2008-09-29 12:28:03 +0000 | |||
3 | +++ AUTHORS 2009-06-02 10:32:00 +0000 | |||
4 | @@ -2,3 +2,5 @@ | |||
5 | 2 | 2 | ||
6 | 3 | Other contributors: | 3 | Other contributors: |
7 | 4 | * Nicolas Barcet <nicolas.barcet@ubuntu.com> | 4 | * Nicolas Barcet <nicolas.barcet@ubuntu.com> |
8 | 5 | * Bernd Zeimetz <bzed@debian.org> | ||
9 | 6 | |||
10 | 5 | \ No newline at end of file | 7 | \ No newline at end of file |
11 | 6 | 8 | ||
12 | === modified file 'VMBuilder/__init__.py' | |||
13 | --- VMBuilder/__init__.py 2008-08-29 22:14:45 +0000 | |||
14 | +++ VMBuilder/__init__.py 2009-06-04 12:22:50 +0000 | |||
15 | @@ -21,10 +21,9 @@ | |||
16 | 21 | # The publically exposed bits of VMBuilder | 21 | # The publically exposed bits of VMBuilder |
17 | 22 | # | 22 | # |
18 | 23 | import logging | 23 | import logging |
20 | 24 | import VMBuilder.plugins | 24 | from VMBuilder.plugins import load_plugins, Plugin |
21 | 25 | from VMBuilder.distro import Distro | 25 | from VMBuilder.distro import Distro |
22 | 26 | from VMBuilder.hypervisor import Hypervisor | 26 | from VMBuilder.hypervisor import Hypervisor |
23 | 27 | from VMBuilder.plugins import Plugin | ||
24 | 28 | from VMBuilder.frontend import Frontend | 27 | from VMBuilder.frontend import Frontend |
25 | 29 | from VMBuilder.vm import VM | 28 | from VMBuilder.vm import VM |
26 | 30 | from VMBuilder.exception import VMBuilderException, VMBuilderUserError | 29 | from VMBuilder.exception import VMBuilderException, VMBuilderUserError |
27 | @@ -66,4 +65,4 @@ | |||
28 | 66 | frontend.run() | 65 | frontend.run() |
29 | 67 | 66 | ||
30 | 68 | logging.debug('Loading plugins') | 67 | logging.debug('Loading plugins') |
32 | 69 | VMBuilder.plugins.load_plugins() | 68 | load_plugins() |
33 | 70 | 69 | ||
34 | === modified file 'VMBuilder/frontend.py' | |||
35 | --- VMBuilder/frontend.py 2008-08-29 22:14:45 +0000 | |||
36 | +++ VMBuilder/frontend.py 2009-06-04 00:42:28 +0000 | |||
37 | @@ -18,22 +18,20 @@ | |||
38 | 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/>. |
39 | 19 | # | 19 | # |
40 | 20 | # Frontend interface and classes | 20 | # Frontend interface and classes |
44 | 21 | 21 | from VMBuilder.exception import VMBuilderException | |
42 | 22 | import VMBuilder | ||
43 | 23 | import optparse | ||
45 | 24 | 22 | ||
46 | 25 | class Frontend(object): | 23 | class Frontend(object): |
47 | 26 | def __init__(self): | 24 | def __init__(self): |
48 | 27 | self.settings = [] | 25 | self.settings = [] |
49 | 28 | 26 | ||
52 | 29 | def setting_group(self, help=None): | 27 | def setting_group(self, setting_help=None): |
53 | 30 | return self.SettingsGroup(help) | 28 | return self.SettingsGroup(setting_help) |
54 | 31 | 29 | ||
55 | 32 | def add_setting_group(self, group): | 30 | def add_setting_group(self, group): |
56 | 33 | self.settings.append(group) | 31 | self.settings.append(group) |
57 | 34 | 32 | ||
58 | 35 | def add_setting(self, **kwargs): | 33 | def add_setting(self, **kwargs): |
60 | 36 | self.settings.append(Setting(**kwargs)) | 34 | self.settings.append(self.Setting(**kwargs)) |
61 | 37 | 35 | ||
62 | 38 | setting_types = ['store', 'store'] | 36 | setting_types = ['store', 'store'] |
63 | 39 | class Setting(object): | 37 | class Setting(object): |
64 | @@ -42,8 +40,8 @@ | |||
65 | 42 | self.longarg = kwargs.get('shortarg', None) | 40 | self.longarg = kwargs.get('shortarg', None) |
66 | 43 | self.default = kwargs.get('default', None) | 41 | self.default = kwargs.get('default', None) |
67 | 44 | self.help = kwargs.get('help', None) | 42 | self.help = kwargs.get('help', None) |
70 | 45 | type = kwargs.get('type', 'store') | 43 | store_type = kwargs.get('type', 'store') |
71 | 46 | if type not in setting_types: | 44 | if store_type not in Frontend.setting_types: |
72 | 47 | raise VMBuilderException("Invalid option type: %s" % type) | 45 | raise VMBuilderException("Invalid option type: %s" % type) |
73 | 48 | 46 | ||
74 | 49 | class SettingsGroup(Setting): | 47 | class SettingsGroup(Setting): |
75 | 50 | 48 | ||
76 | === modified file 'VMBuilder/hypervisor.py' | |||
77 | --- VMBuilder/hypervisor.py 2008-08-29 22:14:45 +0000 | |||
78 | +++ VMBuilder/hypervisor.py 2009-06-04 12:23:59 +0000 | |||
79 | @@ -19,12 +19,12 @@ | |||
80 | 19 | # | 19 | # |
81 | 20 | # Hypervisor super class | 20 | # Hypervisor super class |
82 | 21 | 21 | ||
84 | 22 | import VMBuilder.plugins | 22 | from VMBuilder import Plugin |
85 | 23 | 23 | ||
86 | 24 | STORAGE_DISK_IMAGE = 0 | 24 | STORAGE_DISK_IMAGE = 0 |
87 | 25 | STORAGE_FS_IMAGE = 1 | 25 | STORAGE_FS_IMAGE = 1 |
88 | 26 | 26 | ||
90 | 27 | class Hypervisor(VMBuilder.plugins.Plugin): | 27 | class Hypervisor(Plugin): |
91 | 28 | def finalize(self): | 28 | def finalize(self): |
92 | 29 | raise NotImplemented('Hypervisor subclasses need to implement the finalize method') | 29 | raise NotImplemented('Hypervisor subclasses need to implement the finalize method') |
93 | 30 | 30 | ||
94 | 31 | 31 | ||
95 | === modified file 'VMBuilder/plugins/__init__.py' | |||
96 | --- VMBuilder/plugins/__init__.py 2008-12-11 17:37:29 +0000 | |||
97 | +++ VMBuilder/plugins/__init__.py 2009-06-03 22:31:00 +0000 | |||
98 | @@ -20,6 +20,7 @@ | |||
99 | 20 | import os | 20 | import os |
100 | 21 | import VMBuilder | 21 | import VMBuilder |
101 | 22 | from VMBuilder.util import run_cmd | 22 | from VMBuilder.util import run_cmd |
102 | 23 | from VMBuilder.exception import VMBuilderException | ||
103 | 23 | 24 | ||
104 | 24 | def load_plugins(): | 25 | def load_plugins(): |
105 | 25 | for plugin in find_plugins(): | 26 | for plugin in find_plugins(): |
106 | 26 | 27 | ||
107 | === modified file 'VMBuilder/plugins/cli/__init__.py' | |||
108 | --- VMBuilder/plugins/cli/__init__.py 2009-05-04 13:08:30 +0000 | |||
109 | +++ VMBuilder/plugins/cli/__init__.py 2009-06-04 11:36:56 +0000 | |||
110 | @@ -1,5 +1,6 @@ | |||
111 | 1 | # Uncomplicated VM Builder | 1 | # Uncomplicated VM Builder |
112 | 2 | # Copyright (C) 2007-2008 Canonical Ltd. | 2 | # Copyright (C) 2007-2008 Canonical Ltd. |
113 | 3 | # Copyright (C) 2009 Bernd Zeimetz <bzed@debian.org> | ||
114 | 3 | # | 4 | # |
115 | 4 | # See AUTHORS for list of contributors | 5 | # See AUTHORS for list of contributors |
116 | 5 | # | 6 | # |
117 | @@ -24,13 +25,12 @@ | |||
118 | 24 | import textwrap | 25 | import textwrap |
119 | 25 | import VMBuilder | 26 | import VMBuilder |
120 | 26 | from VMBuilder.disk import parse_size | 27 | from VMBuilder.disk import parse_size |
121 | 27 | import VMBuilder.hypervisor | ||
122 | 28 | _ = gettext | 28 | _ = gettext |
123 | 29 | 29 | ||
124 | 30 | 30 | ||
125 | 31 | class CLI(VMBuilder.Frontend): | 31 | class CLI(VMBuilder.Frontend): |
126 | 32 | arg = 'cli' | 32 | arg = 'cli' |
128 | 33 | 33 | ||
129 | 34 | def run(self): | 34 | def run(self): |
130 | 35 | try: | 35 | try: |
131 | 36 | next = False | 36 | next = False |
132 | @@ -52,7 +52,7 @@ | |||
133 | 52 | self.set_usage(vm) | 52 | self.set_usage(vm) |
134 | 53 | 53 | ||
135 | 54 | vm.optparser.disable_interspersed_args() | 54 | vm.optparser.disable_interspersed_args() |
137 | 55 | (foo, args) = vm.optparser.parse_args() | 55 | args = vm.optparser.parse_args()[1] |
138 | 56 | self.handle_args(vm, args) | 56 | self.handle_args(vm, args) |
139 | 57 | vm.optparser.enable_interspersed_args() | 57 | vm.optparser.enable_interspersed_args() |
140 | 58 | 58 | ||
141 | @@ -93,7 +93,7 @@ | |||
142 | 93 | vm.add_filesystem(size='%dM' % vm.rootsize, type='ext3', mntpnt='/') | 93 | vm.add_filesystem(size='%dM' % vm.rootsize, type='ext3', mntpnt='/') |
143 | 94 | vm.add_filesystem(size='%dM' % vm.swapsize, type='swap', mntpnt=None) | 94 | vm.add_filesystem(size='%dM' % vm.swapsize, type='swap', mntpnt=None) |
144 | 95 | if vm.optsize > 0: | 95 | if vm.optsize > 0: |
146 | 96 | vm.add_filesystem(size='%dM' % optsize, type='ext3', mntpnt='/opt') | 96 | vm.add_filesystem(size='%dM' % vm.optsize, type='ext3', mntpnt='/opt') |
147 | 97 | else: | 97 | else: |
148 | 98 | if vm.raw: | 98 | if vm.raw: |
149 | 99 | disk = vm.add_disk(filename=vm.raw, preallocated=True) | 99 | disk = vm.add_disk(filename=vm.raw, preallocated=True) |
150 | @@ -161,22 +161,38 @@ | |||
151 | 161 | disk.add_part(offset, int(pair[1]), 'ext3', pair[0]) | 161 | disk.add_part(offset, int(pair[1]), 'ext3', pair[0]) |
152 | 162 | offset += int(pair[1]) | 162 | offset += int(pair[1]) |
153 | 163 | 163 | ||
156 | 164 | class UVB(CLI): | 164 | class VB(CLI): |
157 | 165 | arg = 'ubuntu-vm-builder' | 165 | arg = 'vb' |
158 | 166 | suites = [] | ||
159 | 167 | distro = '' | ||
160 | 166 | 168 | ||
161 | 167 | def set_usage(self, vm): | 169 | def set_usage(self, vm): |
162 | 168 | vm.optparser.set_usage('%prog hypervisor suite [options]') | 170 | vm.optparser.set_usage('%prog hypervisor suite [options]') |
163 | 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)) |
164 | 170 | 172 | ||
165 | 171 | def suite_help(self): | 173 | def suite_help(self): |
167 | 172 | return 'Suite. Valid options: %s' % " ".join(VMBuilder.plugins.ubuntu.distro.Ubuntu.suites) | 174 | return 'Suite. Valid options: %s' % " ".join(self.suites) |
168 | 173 | 175 | ||
169 | 174 | def handle_args(self, vm, args): | 176 | def handle_args(self, vm, args): |
170 | 175 | if len(args) < 2: | 177 | if len(args) < 2: |
171 | 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") |
172 | 177 | vm.set_hypervisor(args[0]) | 179 | vm.set_hypervisor(args[0]) |
174 | 178 | vm.set_distro('ubuntu') | 180 | vm.set_distro(self.distro) |
175 | 179 | vm.suite = args[1] | 181 | vm.suite = args[1] |
176 | 180 | 182 | ||
177 | 183 | class UVB(VB): | ||
178 | 184 | arg = 'ubuntu-vm-builder' | ||
179 | 185 | import VMBuilder.plugins.ubuntu as ubuntu | ||
180 | 186 | suites = ubuntu.distro.Ubuntu.suites | ||
181 | 187 | distro = 'ubuntu' | ||
182 | 188 | |||
183 | 189 | class DVB(VB): | ||
184 | 190 | arg = 'debian-vm-builder' | ||
185 | 191 | import VMBuilder.plugins.debian as debian | ||
186 | 192 | suites = debian.distro.Debian.suites | ||
187 | 193 | distro = 'debian' | ||
188 | 194 | |||
189 | 195 | |||
190 | 181 | VMBuilder.register_frontend(CLI) | 196 | VMBuilder.register_frontend(CLI) |
191 | 182 | VMBuilder.register_frontend(UVB) | 197 | VMBuilder.register_frontend(UVB) |
192 | 198 | VMBuilder.register_frontend(DVB) | ||
193 | 183 | 199 | ||
194 | === added directory 'VMBuilder/plugins/debian' | |||
195 | === added file 'VMBuilder/plugins/debian/__init__.py' | |||
196 | --- VMBuilder/plugins/debian/__init__.py 1970-01-01 00:00:00 +0000 | |||
197 | +++ VMBuilder/plugins/debian/__init__.py 2009-06-02 12:04:26 +0000 | |||
198 | @@ -0,0 +1,21 @@ | |||
199 | 1 | # | ||
200 | 2 | # Uncomplicated VM Builder | ||
201 | 3 | # Copyright (C) 2007-2008 Canonical Ltd. | ||
202 | 4 | # Copyright (C) 2009 Bernd Zeimetz <bzed@debian.org> | ||
203 | 5 | # | ||
204 | 6 | # See AUTHORS for list of contributors | ||
205 | 7 | # | ||
206 | 8 | # This program is free software: you can redistribute it and/or modify | ||
207 | 9 | # it under the terms of the GNU General Public License as published by | ||
208 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
209 | 11 | # (at your option) any later version. | ||
210 | 12 | # | ||
211 | 13 | # This program is distributed in the hope that it will be useful, | ||
212 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
213 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
214 | 16 | # GNU General Public License for more details. | ||
215 | 17 | # | ||
216 | 18 | # You should have received a copy of the GNU General Public License | ||
217 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
218 | 20 | # | ||
219 | 21 | import distro | ||
220 | 0 | 22 | ||
221 | === added file 'VMBuilder/plugins/debian/distro.py' | |||
222 | --- VMBuilder/plugins/debian/distro.py 1970-01-01 00:00:00 +0000 | |||
223 | +++ VMBuilder/plugins/debian/distro.py 2009-06-03 09:40:36 +0000 | |||
224 | @@ -0,0 +1,195 @@ | |||
225 | 1 | # | ||
226 | 2 | # Uncomplicated VM Builder | ||
227 | 3 | # Copyright (C) 2007-2008 Canonical Ltd. | ||
228 | 4 | # Copyright (C) 2009 Bernd Zeimetz <bzed@debian.org> | ||
229 | 5 | # | ||
230 | 6 | # See AUTHORS for list of contributors | ||
231 | 7 | # | ||
232 | 8 | # This program is free software: you can redistribute it and/or modify | ||
233 | 9 | # it under the terms of the GNU General Public License as published by | ||
234 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
235 | 11 | # (at your option) any later version. | ||
236 | 12 | # | ||
237 | 13 | # This program is distributed in the hope that it will be useful, | ||
238 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
239 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
240 | 16 | # GNU General Public License for more details. | ||
241 | 17 | # | ||
242 | 18 | # You should have received a copy of the GNU General Public License | ||
243 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
244 | 20 | # | ||
245 | 21 | import logging | ||
246 | 22 | import os | ||
247 | 23 | import socket | ||
248 | 24 | import types | ||
249 | 25 | import VMBuilder | ||
250 | 26 | from VMBuilder import register_distro, Distro | ||
251 | 27 | from VMBuilder.util import run_cmd | ||
252 | 28 | from VMBuilder.exception import VMBuilderUserError, VMBuilderException | ||
253 | 29 | |||
254 | 30 | class Debian(Distro): | ||
255 | 31 | name = 'Debian' | ||
256 | 32 | arg = 'debian' | ||
257 | 33 | suites = ['etch'] | ||
258 | 34 | |||
259 | 35 | # Maps host arch to valid guest archs | ||
260 | 36 | # FIXME: Running a amd64 kernel with an i386 userspace allows us to run | ||
261 | 37 | # amd64 guests | ||
262 | 38 | |||
263 | 39 | valid_archs = { 'amd64' : ['amd64', 'i386' ], | ||
264 | 40 | 'i386' : [ 'i386' ] } | ||
265 | 41 | |||
266 | 42 | xen_kernel = '' | ||
267 | 43 | |||
268 | 44 | def register_options(self): | ||
269 | 45 | group = self.vm.setting_group('Package options') | ||
270 | 46 | group.add_option('--addpkg', action='append', metavar='PKG', help='Install PKG into the guest (can be specfied multiple times).') | ||
271 | 47 | group.add_option('--removepkg', action='append', metavar='PKG', help='Remove PKG from the guest (can be specfied multiple times)') | ||
272 | 48 | self.vm.register_setting_group(group) | ||
273 | 49 | |||
274 | 50 | group = self.vm.setting_group('General OS options') | ||
275 | 51 | self.host_arch = run_cmd('dpkg', '--print-architecture').rstrip() | ||
276 | 52 | group.add_option('-a', '--arch', default=self.host_arch, help='Specify the target architecture. Valid options: amd64 i386 lpia (defaults to host arch)') | ||
277 | 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.') | ||
278 | 54 | self.vm.register_setting_group(group) | ||
279 | 55 | |||
280 | 56 | # FIXME: Add Debian ports | ||
281 | 57 | group = self.vm.setting_group('Installation options') | ||
282 | 58 | group.add_option('--suite', default='etch', help='Suite to install. Valid options: %s [default: %%default]' % ' '.join(self.suites)) | ||
283 | 59 | group.add_option('--flavour', '--kernel-flavour', help='Kernel flavour to use. Default and valid options depend on architecture and suite') | ||
284 | 60 | group.add_option('--variant', metavar='VARIANT', help='Passed to debootstrap --variant flag; use minbase, buildd, or fakechroot.') | ||
285 | 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.') | ||
286 | 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.') | ||
287 | 63 | group.add_option('--proxy', metavar='URL', help='Use proxy at URL for cached packages') | ||
288 | 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') | ||
289 | 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.') | ||
290 | 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') | ||
291 | 67 | group.add_option('--components', metavar='COMPS', help='A comma seperated list of distro components to include (e.g. main,contrib,non-free).') | ||
292 | 68 | group.add_option('--lang', metavar='LANG', default=self.get_locale(), help='Set the locale to LANG [default: %default]') | ||
293 | 69 | self.vm.register_setting_group(group) | ||
294 | 70 | |||
295 | 71 | group = self.vm.setting_group('Settings for the initial user') | ||
296 | 72 | group.add_option('--user', default='debian', help='Username of initial user [default: %default]') | ||
297 | 73 | group.add_option('--name', default='Debian', help='Full name of initial user [default: %default]') | ||
298 | 74 | group.add_option('--pass', default='debian', help='Password of initial user [default: %default]') | ||
299 | 75 | group.add_option('--rootpass', help='Initial root password (WARNING: this has strong security implications).') | ||
300 | 76 | self.vm.register_setting_group(group) | ||
301 | 77 | |||
302 | 78 | group = self.vm.setting_group('Other options') | ||
303 | 79 | group.add_option('--ssh-key', metavar='PATH', help='Add PATH to root\'s ~/.ssh/authorized_keys (WARNING: this has strong security implications).') | ||
304 | 80 | group.add_option('--ssh-user-key', help='Add PATH to the user\'s ~/.ssh/authorized_keys.') | ||
305 | 81 | self.vm.register_setting_group(group) | ||
306 | 82 | |||
307 | 83 | def set_defaults(self): | ||
308 | 84 | if not self.vm.mirror: | ||
309 | 85 | #if self.vm.arch == 'lpia': | ||
310 | 86 | # self.vm.mirror = 'http://ports.ubuntu.com/ubuntu-ports' | ||
311 | 87 | #else: | ||
312 | 88 | self.vm.mirror = 'http://ftp.debian.org/debian' | ||
313 | 89 | |||
314 | 90 | if not self.vm.security_mirror: | ||
315 | 91 | #if self.vm.arch == 'lpia': | ||
316 | 92 | # self.vm.security_mirror = 'http://ports.ubuntu.com/ubuntu-ports' | ||
317 | 93 | #else: | ||
318 | 94 | self.vm.security_mirror = 'http://security.debian.org/debian-security' | ||
319 | 95 | |||
320 | 96 | if not self.vm.components: | ||
321 | 97 | self.vm.components = ['main'] | ||
322 | 98 | else: | ||
323 | 99 | self.vm.components = self.vm.components.split(',') | ||
324 | 100 | |||
325 | 101 | def get_locale(self): | ||
326 | 102 | return os.getenv('LANG') | ||
327 | 103 | |||
328 | 104 | def preflight_check(self): | ||
329 | 105 | """While not all of these are strictly checks, their failure would inevitably | ||
330 | 106 | lead to failure, and since we can check them before we start setting up disk | ||
331 | 107 | and whatnot, we might as well go ahead an do this now.""" | ||
332 | 108 | |||
333 | 109 | if not self.vm.suite in self.suites: | ||
334 | 110 | raise VMBuilderUserError('Invalid suite. Valid suites are: %s' % ' '.join(self.suites)) | ||
335 | 111 | |||
336 | 112 | modname = 'VMBuilder.plugins.debian.%s' % (self.vm.suite, ) | ||
337 | 113 | mod = __import__(modname, fromlist=[self.vm.suite]) | ||
338 | 114 | self.suite = getattr(mod, self.vm.suite.capitalize())(self.vm) | ||
339 | 115 | |||
340 | 116 | if self.vm.arch not in self.valid_archs[self.host_arch] or \ | ||
341 | 117 | not self.suite.check_arch_validity(self.vm.arch): | ||
342 | 118 | raise VMBuilderUserError('%s is not a valid architecture. Valid architectures are: %s' % (self.vm.arch, | ||
343 | 119 | ' '.join(self.valid_archs[self.host_arch]))) | ||
344 | 120 | |||
345 | 121 | if not self.vm.components: | ||
346 | 122 | self.vm.components = ['main', 'restricted', 'universe'] | ||
347 | 123 | else: | ||
348 | 124 | if type(self.vm.components) is str: | ||
349 | 125 | self.vm.components = self.vm.components.split(',') | ||
350 | 126 | |||
351 | 127 | if self.vm.hypervisor.name == 'Xen': | ||
352 | 128 | logging.info('Xen kernel default: linux-image-%s %s', self.suite.xen_kernel_flavour, self.xen_kernel_version()) | ||
353 | 129 | |||
354 | 130 | self.vm.virtio_net = self.use_virtio_net() | ||
355 | 131 | |||
356 | 132 | if self.vm.lang: | ||
357 | 133 | try: | ||
358 | 134 | run_cmd('locale-gen', '%s' % self.vm.lang) | ||
359 | 135 | except VMBuilderException, e: | ||
360 | 136 | msg = "locale-gen does not recognize your locale '%s'" % self.vm.lang | ||
361 | 137 | raise VMBuilderUserError(msg) | ||
362 | 138 | |||
363 | 139 | def install(self, destdir): | ||
364 | 140 | self.destdir = destdir | ||
365 | 141 | self.suite.install(destdir) | ||
366 | 142 | |||
367 | 143 | def install_vmbuilder_log(self, logfile, rootdir): | ||
368 | 144 | self.suite.install_vmbuilder_log(logfile, rootdir) | ||
369 | 145 | |||
370 | 146 | def post_mount(self, fs): | ||
371 | 147 | self.suite.post_mount(fs) | ||
372 | 148 | |||
373 | 149 | def use_virtio_net(self): | ||
374 | 150 | return self.suite.virtio_net | ||
375 | 151 | |||
376 | 152 | def install_bootloader(self): | ||
377 | 153 | devmapfile = '%s/device.map' % self.vm.workdir | ||
378 | 154 | devmap = open(devmapfile, 'w') | ||
379 | 155 | for (disk, id) in zip(self.vm.disks, range(len(self.vm.disks))): | ||
380 | 156 | devmap.write("(hd%d) %s\n" % (id, disk.filename)) | ||
381 | 157 | devmap.close() | ||
382 | 158 | run_cmd('grub', '--device-map=%s' % devmapfile, '--batch', stdin='''root (hd0,0) | ||
383 | 159 | setup (hd0) | ||
384 | 160 | EOT''') | ||
385 | 161 | |||
386 | 162 | def xen_kernel_version(self): | ||
387 | 163 | if self.suite.xen_kernel_flavour: | ||
388 | 164 | if not self.xen_kernel: | ||
389 | 165 | rmad = run_cmd('rmadison', 'linux-image-%s' % self.suite.xen_kernel_flavour) | ||
390 | 166 | version = ['0', '0','0', '0'] | ||
391 | 167 | |||
392 | 168 | for line in rmad.splitlines(): | ||
393 | 169 | sline = line.split('|') | ||
394 | 170 | |||
395 | 171 | if sline[2].strip().startswith(self.vm.suite): | ||
396 | 172 | vt = sline[1].strip().split('.') | ||
397 | 173 | for i in range(4): | ||
398 | 174 | if int(vt[i]) > int(version[i]): | ||
399 | 175 | version = vt | ||
400 | 176 | break | ||
401 | 177 | |||
402 | 178 | if version[0] == '0': | ||
403 | 179 | raise VMBuilderException('Something is wrong, no valid xen kernel for the suite %s found by rmadison' % self.vm.suite) | ||
404 | 180 | |||
405 | 181 | self.xen_kernel = '%s.%s.%s-%s' % (version[0],version[1],version[2],version[3]) | ||
406 | 182 | return self.xen_kernel | ||
407 | 183 | else: | ||
408 | 184 | raise VMBuilderUserError('There is no valid xen kernel for the suite selected.') | ||
409 | 185 | |||
410 | 186 | def xen_kernel_path(self): | ||
411 | 187 | path = '/boot/vmlinuz-%s-%s' % (self.xen_kernel_version(), self.suite.xen_kernel_flavour) | ||
412 | 188 | return path | ||
413 | 189 | |||
414 | 190 | def xen_ramdisk_path(self): | ||
415 | 191 | path = '/boot/initrd.img-%s-%s' % (self.xen_kernel_version(), self.suite.xen_kernel_flavour) | ||
416 | 192 | return path | ||
417 | 193 | |||
418 | 194 | |||
419 | 195 | register_distro(Debian) | ||
420 | 0 | 196 | ||
421 | === added file 'VMBuilder/plugins/debian/etch.py' | |||
422 | --- VMBuilder/plugins/debian/etch.py 1970-01-01 00:00:00 +0000 | |||
423 | +++ VMBuilder/plugins/debian/etch.py 2009-06-04 13:21:36 +0000 | |||
424 | @@ -0,0 +1,342 @@ | |||
425 | 1 | # | ||
426 | 2 | # Uncomplicated VM Builder | ||
427 | 3 | # Copyright (C) 2007-2008 Canonical Ltd. | ||
428 | 4 | # Copyright (C) 2009 Bernd Zeimetz <bzed@debian.org> | ||
429 | 5 | # | ||
430 | 6 | # See AUTHORS for list of contributors | ||
431 | 7 | # | ||
432 | 8 | # This program is free software: you can redistribute it and/or modify | ||
433 | 9 | # it under the terms of the GNU General Public License as published by | ||
434 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
435 | 11 | # (at your option) any later version. | ||
436 | 12 | # | ||
437 | 13 | # This program is distributed in the hope that it will be useful, | ||
438 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
439 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
440 | 16 | # GNU General Public License for more details. | ||
441 | 17 | # | ||
442 | 18 | # You should have received a copy of the GNU General Public License | ||
443 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
444 | 20 | # | ||
445 | 21 | import glob | ||
446 | 22 | import logging | ||
447 | 23 | import os | ||
448 | 24 | import shutil | ||
449 | 25 | import socket | ||
450 | 26 | import tempfile | ||
451 | 27 | import VMBuilder | ||
452 | 28 | import VMBuilder.disk as disk | ||
453 | 29 | import VMBuilder.suite as suite | ||
454 | 30 | from VMBuilder.util import run_cmd | ||
455 | 31 | |||
456 | 32 | class Etch(suite.Suite): | ||
457 | 33 | updategrub = "/usr/sbin/update-grub" | ||
458 | 34 | grubroot = "/usr/lib/grub" | ||
459 | 35 | |||
460 | 36 | valid_flavours = { 'i386' : ['486', '686', '686-bigmem', | ||
461 | 37 | '686-bigmem-etchnhalf', '686-etchnhalf', | ||
462 | 38 | '686-smp', 'vserver-686'], | ||
463 | 39 | 'amd64' : ['amd64', 'amd64-etchnhalf', 'amd64-generic', | ||
464 | 40 | 'amd64-k8', 'amd64-k8-smp', 'vserver-amd64', | ||
465 | 41 | 'vserver-amd64-k8-smp']} | ||
466 | 42 | |||
467 | 43 | default_flavour = { 'i386' : '686-etchnhalf', 'amd64' : 'amd64-etchnhalf' } | ||
468 | 44 | disk_prefix = 'sd' | ||
469 | 45 | xen_kernel_flavour = None | ||
470 | 46 | virtio_net = False | ||
471 | 47 | |||
472 | 48 | def check_kernel_flavour(self, arch, flavour): | ||
473 | 49 | return flavour in self.valid_flavours[arch] | ||
474 | 50 | |||
475 | 51 | def check_arch_validity(self, arch): | ||
476 | 52 | return arch in self.valid_flavours.keys() | ||
477 | 53 | |||
478 | 54 | def install(self, destdir): | ||
479 | 55 | self.destdir = destdir | ||
480 | 56 | |||
481 | 57 | logging.debug("debootstrapping") | ||
482 | 58 | self.debootstrap() | ||
483 | 59 | |||
484 | 60 | logging.debug("Setting up sources.list") | ||
485 | 61 | self.install_sources_list() | ||
486 | 62 | |||
487 | 63 | logging.debug("Setting up apt proxy") | ||
488 | 64 | self.install_apt_proxy() | ||
489 | 65 | |||
490 | 66 | logging.debug("Installing fstab") | ||
491 | 67 | self.install_fstab() | ||
492 | 68 | |||
493 | 69 | logging.debug("Creating devices") | ||
494 | 70 | self.create_devices() | ||
495 | 71 | |||
496 | 72 | if self.vm.hypervisor.needs_bootloader: | ||
497 | 73 | logging.debug("Installing grub") | ||
498 | 74 | self.install_grub() | ||
499 | 75 | |||
500 | 76 | logging.debug("Configuring guest networking") | ||
501 | 77 | self.config_network() | ||
502 | 78 | |||
503 | 79 | logging.debug("Preventing daemons from starting") | ||
504 | 80 | self.prevent_daemons_starting() | ||
505 | 81 | |||
506 | 82 | if self.vm.hypervisor.needs_bootloader: | ||
507 | 83 | logging.debug("Installing menu.list") | ||
508 | 84 | self.install_menu_lst() | ||
509 | 85 | |||
510 | 86 | logging.debug("Installing kernel") | ||
511 | 87 | self.install_kernel() | ||
512 | 88 | |||
513 | 89 | logging.debug("Creating device.map") | ||
514 | 90 | self.install_device_map() | ||
515 | 91 | |||
516 | 92 | logging.debug("Installing extra packages") | ||
517 | 93 | self.install_extras() | ||
518 | 94 | |||
519 | 95 | logging.debug("Creating initial user") | ||
520 | 96 | self.create_initial_user() | ||
521 | 97 | |||
522 | 98 | logging.debug("Installing ssh keys") | ||
523 | 99 | self.install_authorized_keys() | ||
524 | 100 | |||
525 | 101 | logging.debug("Installing locales") | ||
526 | 102 | self.install_locales() | ||
527 | 103 | |||
528 | 104 | logging.debug("Copy host settings") | ||
529 | 105 | self.copy_settings() | ||
530 | 106 | |||
531 | 107 | logging.debug("Making sure system is up-to-date") | ||
532 | 108 | self.update() | ||
533 | 109 | |||
534 | 110 | logging.debug("Setting up final sources.list") | ||
535 | 111 | self.install_sources_list(final=True) | ||
536 | 112 | |||
537 | 113 | logging.debug("Unmounting volatile lrm filesystems") | ||
538 | 114 | self.unmount_volatile() | ||
539 | 115 | |||
540 | 116 | logging.debug("Unpreventing daemons from starting") | ||
541 | 117 | self.unprevent_daemons_starting() | ||
542 | 118 | |||
543 | 119 | def update(self): | ||
544 | 120 | self.run_in_target('apt-get', '-y', '--force-yes', 'dist-upgrade', | ||
545 | 121 | env={ 'DEBIAN_FRONTEND' : 'noninteractive' }) | ||
546 | 122 | |||
547 | 123 | def install_authorized_keys(self): | ||
548 | 124 | if self.vm.ssh_key: | ||
549 | 125 | os.mkdir('%s/root/.ssh' % self.destdir, 0700) | ||
550 | 126 | shutil.copy(self.vm.ssh_key, '%s/root/.ssh/authorized_keys' % self.destdir) | ||
551 | 127 | os.chmod('%s/root/.ssh/authorized_keys' % self.destdir, 0644) | ||
552 | 128 | if self.vm.ssh_user_key: | ||
553 | 129 | os.mkdir('%s/home/%s/.ssh' % (self.destdir, self.vm.user), 0700) | ||
554 | 130 | shutil.copy(self.vm.ssh_user_key, '%s/home/%s/.ssh/authorized_keys' % (self.destdir, self.vm.user)) | ||
555 | 131 | os.chmod('%s/home/%s/.ssh/authorized_keys' % (self.destdir, self.vm.user), 0644) | ||
556 | 132 | self.run_in_target('chown', '-R', '%s:%s' % (self.vm.user,)*2, '/home/%s/.ssh/' % (self.vm.user)) | ||
557 | 133 | |||
558 | 134 | if self.vm.ssh_user_key or self.vm.ssh_key: | ||
559 | 135 | if not self.vm.addpkg: | ||
560 | 136 | self.vm.addpkg = [] | ||
561 | 137 | self.vm.addpkg += ['openssh-server'] | ||
562 | 138 | |||
563 | 139 | def update_passwords(self): | ||
564 | 140 | # Set the user password, using md5 | ||
565 | 141 | self.run_in_target('chpasswd', '-m', stdin=('%s:%s\n' % (self.vm.user, getattr(self.vm, 'pass')))) | ||
566 | 142 | |||
567 | 143 | # Lock root account only if we didn't set the root password | ||
568 | 144 | if self.vm.rootpass: | ||
569 | 145 | self.run_in_target('chpasswd', '-m', stdin=('%s:%s\n' % ('root', self.vm.rootpass))) | ||
570 | 146 | else: | ||
571 | 147 | self.run_in_target('chpasswd', '-e', stdin='root:!\n') | ||
572 | 148 | |||
573 | 149 | def create_initial_user(self): | ||
574 | 150 | self.run_in_target('adduser', '--disabled-password', '--gecos', self.vm.name, self.vm.user) | ||
575 | 151 | self.run_in_target('addgroup', '--system', 'admin') | ||
576 | 152 | self.run_in_target('adduser', self.vm.user, 'admin') | ||
577 | 153 | |||
578 | 154 | self.install_from_template('/etc/sudoers', 'sudoers') | ||
579 | 155 | for group in ['adm', 'audio', 'cdrom', 'dialout', 'floppy', 'video', 'plugdev', 'dip', 'netdev', 'powerdev', 'lpadmin', 'scanner']: | ||
580 | 156 | self.run_in_target('adduser', self.vm.user, group, ignore_fail=True) | ||
581 | 157 | |||
582 | 158 | self.update_passwords() | ||
583 | 159 | |||
584 | 160 | def kernel_name(self): | ||
585 | 161 | return 'linux-image-2.6-%s' % (self.vm.flavour or self.default_flavour[self.vm.arch],) | ||
586 | 162 | |||
587 | 163 | def config_network(self): | ||
588 | 164 | self.vm.install_file('/etc/hostname', self.vm.hostname) | ||
589 | 165 | self.install_from_template('/etc/hosts', 'etc_hosts', { 'hostname' : self.vm.hostname, 'domain' : self.vm.domain }) | ||
590 | 166 | self.install_from_template('/etc/network/interfaces', 'interfaces') | ||
591 | 167 | |||
592 | 168 | def unprevent_daemons_starting(self): | ||
593 | 169 | os.unlink('%s/usr/sbin/policy-rc.d' % self.destdir) | ||
594 | 170 | |||
595 | 171 | def prevent_daemons_starting(self): | ||
596 | 172 | os.chmod(self.install_from_template('/usr/sbin/policy-rc.d', 'nostart-policy-rc.d'), 0755) | ||
597 | 173 | |||
598 | 174 | def install_extras(self): | ||
599 | 175 | if not self.vm.addpkg and not self.vm.removepkg: | ||
600 | 176 | return | ||
601 | 177 | cmd = ['apt-get', 'install', '-y', '--force-yes'] | ||
602 | 178 | cmd += self.vm.addpkg or [] | ||
603 | 179 | cmd += ['%s-' % pkg for pkg in self.vm.removepkg or []] | ||
604 | 180 | self.run_in_target(env={ 'DEBIAN_FRONTEND' : 'noninteractive' }, *cmd) | ||
605 | 181 | |||
606 | 182 | def unmount_volatile(self): | ||
607 | 183 | for mntpnt in glob.glob('%s/lib/modules/*/volatile' % self.destdir): | ||
608 | 184 | logging.debug("Unmounting %s" % mntpnt) | ||
609 | 185 | run_cmd('umount', mntpnt) | ||
610 | 186 | |||
611 | 187 | def install_menu_lst(self): | ||
612 | 188 | run_cmd('mount', '--bind', '/dev', '%s/dev' % self.destdir) | ||
613 | 189 | self.vm.add_clean_cmd('umount', '%s/dev' % self.destdir, ignore_fail=True) | ||
614 | 190 | |||
615 | 191 | self.run_in_target('mount', '-t', 'proc', 'proc', '/proc') | ||
616 | 192 | self.vm.add_clean_cmd('umount', '%s/proc' % self.destdir, ignore_fail=True) | ||
617 | 193 | |||
618 | 194 | self.run_in_target(self.updategrub, '-y') | ||
619 | 195 | self.mangle_grub_menu_lst() | ||
620 | 196 | self.run_in_target(self.updategrub) | ||
621 | 197 | self.run_in_target('grub-set-default', '0') | ||
622 | 198 | |||
623 | 199 | run_cmd('umount', '%s/dev' % self.destdir) | ||
624 | 200 | run_cmd('umount', '%s/proc' % self.destdir) | ||
625 | 201 | |||
626 | 202 | def mangle_grub_menu_lst(self): | ||
627 | 203 | bootdev = disk.bootpart(self.vm.disks) | ||
628 | 204 | run_cmd('sed', '-ie', 's/^# kopt=root=\([^ ]*\)\(.*\)/# kopt=root=UUID=%s\\2/g' % bootdev.fs.uuid, '%s/boot/grub/menu.lst' % self.destdir) | ||
629 | 205 | run_cmd('sed', '-ie', 's/^# groot.*/# groot %s/g' % bootdev.get_grub_id(), '%s/boot/grub/menu.lst' % self.destdir) | ||
630 | 206 | run_cmd('sed', '-ie', '/^# kopt_2_6/ d', '%s/boot/grub/menu.lst' % self.destdir) | ||
631 | 207 | |||
632 | 208 | def install_sources_list(self, final=False): | ||
633 | 209 | if final: | ||
634 | 210 | mirror, updates_mirror, security_mirror = self.vm.mirror, self.vm.mirror, self.vm.security_mirror | ||
635 | 211 | else: | ||
636 | 212 | mirror, updates_mirror, security_mirror = self.install_mirrors() | ||
637 | 213 | |||
638 | 214 | self.install_from_template('/etc/apt/sources.list', 'sources.list', { 'mirror' : mirror, 'security_mirror' : security_mirror, 'updates_mirror' : updates_mirror }) | ||
639 | 215 | |||
640 | 216 | # If setting up the final mirror, allow apt-get update to fail | ||
641 | 217 | # (since we might be on a complete different network than the | ||
642 | 218 | # final vm is going to be on). | ||
643 | 219 | self.run_in_target('apt-get', 'update', ignore_fail=final) | ||
644 | 220 | |||
645 | 221 | def install_apt_proxy(self): | ||
646 | 222 | if self.vm.proxy is not None: | ||
647 | 223 | self.vm.install_file('/etc/apt/apt.conf', '// Proxy added by vmbuilder\nAcquire::http { Proxy "%s"; };' % self.vm.proxy) | ||
648 | 224 | |||
649 | 225 | def install_fstab(self): | ||
650 | 226 | if self.vm.hypervisor.preferred_storage == VMBuilder.hypervisor.STORAGE_FS_IMAGE: | ||
651 | 227 | self.install_from_template('/etc/fstab', 'etch_fstab_fsimage', { 'fss' : disk.get_ordered_filesystems(self.vm), 'prefix' : self.disk_prefix }) | ||
652 | 228 | else: | ||
653 | 229 | self.install_from_template('/etc/fstab', 'etch_fstab', { 'parts' : disk.get_ordered_partitions(self.vm.disks), 'prefix' : self.disk_prefix }) | ||
654 | 230 | |||
655 | 231 | def install_device_map(self): | ||
656 | 232 | self.install_from_template('/boot/grub/device.map', 'devicemap', { 'prefix' : self.disk_prefix }) | ||
657 | 233 | |||
658 | 234 | def debootstrap(self): | ||
659 | 235 | cmd = ['/usr/sbin/debootstrap', '--arch=%s' % self.vm.arch] | ||
660 | 236 | if self.vm.variant: | ||
661 | 237 | cmd += ['--variant=%s' % self.vm.variant] | ||
662 | 238 | cmd += [self.vm.suite, self.destdir, self.debootstrap_mirror()] | ||
663 | 239 | kwargs = { 'env' : { 'DEBIAN_FRONTEND' : 'noninteractive' } } | ||
664 | 240 | if self.vm.proxy: | ||
665 | 241 | kwargs['env']['http_proxy'] = self.vm.proxy | ||
666 | 242 | run_cmd(*cmd, **kwargs) | ||
667 | 243 | |||
668 | 244 | def debootstrap_mirror(self): | ||
669 | 245 | if self.vm.iso: | ||
670 | 246 | isodir = tempfile.mkdtemp() | ||
671 | 247 | self.vm.add_clean_cb(lambda:os.rmdir(isodir)) | ||
672 | 248 | run_cmd('mount', '-o', 'loop', '-t', 'iso9660', self.vm.iso, isodir) | ||
673 | 249 | self.vm.add_clean_cmd('umount', isodir) | ||
674 | 250 | self.iso_mounted = True | ||
675 | 251 | |||
676 | 252 | return 'file://%s' % isodir | ||
677 | 253 | else: | ||
678 | 254 | return self.install_mirrors()[0] | ||
679 | 255 | |||
680 | 256 | |||
681 | 257 | def install_mirrors(self): | ||
682 | 258 | if self.vm.iso: | ||
683 | 259 | mirror = "file:///isomnt" | ||
684 | 260 | elif self.vm.install_mirror: | ||
685 | 261 | mirror = self.vm.install_mirror | ||
686 | 262 | else: | ||
687 | 263 | mirror = self.vm.mirror | ||
688 | 264 | |||
689 | 265 | if self.vm.install_mirror: | ||
690 | 266 | updates_mirror = self.vm.install_mirror | ||
691 | 267 | else: | ||
692 | 268 | updates_mirror = self.vm.mirror | ||
693 | 269 | |||
694 | 270 | if self.vm.install_security_mirror: | ||
695 | 271 | security_mirror = self.vm.install_security_mirror | ||
696 | 272 | else: | ||
697 | 273 | security_mirror = self.vm.security_mirror | ||
698 | 274 | |||
699 | 275 | return (mirror, updates_mirror, security_mirror) | ||
700 | 276 | |||
701 | 277 | def install_kernel(self): | ||
702 | 278 | self.install_from_template('/etc/kernel-img.conf', 'kernelimg', { 'updategrub' : self.updategrub }) | ||
703 | 279 | run_cmd('chroot', self.destdir, 'apt-get', '--force-yes', '-y', 'install', self.kernel_name(), 'grub') | ||
704 | 280 | |||
705 | 281 | def install_grub(self): | ||
706 | 282 | self.run_in_target('apt-get', '--force-yes', '-y', 'install', 'grub') | ||
707 | 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) | ||
708 | 284 | |||
709 | 285 | |||
710 | 286 | def install_locales(self): | ||
711 | 287 | self.run_in_target('apt-get', '--force-yes', '-y', 'install', 'locales') | ||
712 | 288 | |||
713 | 289 | def create_devices(self): | ||
714 | 290 | import VMBuilder.plugins.xen | ||
715 | 291 | |||
716 | 292 | if isinstance(self.vm.hypervisor, VMBuilder.plugins.xen.Xen): | ||
717 | 293 | self.run_in_target('mknod', '/dev/xvda', 'b', '202', '0') | ||
718 | 294 | self.run_in_target('mknod', '/dev/xvda1', 'b', '202', '1') | ||
719 | 295 | self.run_in_target('mknod', '/dev/xvda2', 'b', '202', '2') | ||
720 | 296 | self.run_in_target('mknod', '/dev/xvda3', 'b', '202', '3') | ||
721 | 297 | self.run_in_target('mknod', '/dev/xvc0', 'c', '204', '191') | ||
722 | 298 | |||
723 | 299 | def install_from_template(self, *args, **kwargs): | ||
724 | 300 | return self.vm.distro.install_from_template(*args, **kwargs) | ||
725 | 301 | |||
726 | 302 | def run_in_target(self, *args, **kwargs): | ||
727 | 303 | self.vm.distro.run_in_target(*args, **kwargs) | ||
728 | 304 | |||
729 | 305 | def copy_to_target(self, infile, destpath): | ||
730 | 306 | logging.debug("Copying %s on host to %s in guest" % (infile, destpath)) | ||
731 | 307 | dir = '%s/%s' % (self.destdir, os.path.dirname(destpath)) | ||
732 | 308 | if not os.path.isdir(dir): | ||
733 | 309 | os.makedirs(dir) | ||
734 | 310 | if os.path.isdir(infile): | ||
735 | 311 | shutil.copytree(infile, '%s/%s' % (self.destdir, destpath)) | ||
736 | 312 | else: | ||
737 | 313 | shutil.copy(infile, '%s/%s' % (self.destdir, destpath)) | ||
738 | 314 | |||
739 | 315 | def post_mount(self, fs): | ||
740 | 316 | if fs.mntpnt == '/': | ||
741 | 317 | logging.debug("Creating /var/run in root filesystem") | ||
742 | 318 | os.makedirs('%s/var/run' % fs.mntpath) | ||
743 | 319 | logging.debug("Creating /var/lock in root filesystem") | ||
744 | 320 | os.makedirs('%s/var/lock' % fs.mntpath) | ||
745 | 321 | |||
746 | 322 | |||
747 | 323 | def copy_settings(self): | ||
748 | 324 | self.copy_to_target('/etc/default/locale', '/etc/default/locale') | ||
749 | 325 | csdir = '%s/etc/console-setup' % self.destdir | ||
750 | 326 | have_cs = os.path.isdir(csdir) | ||
751 | 327 | if have_cs: | ||
752 | 328 | shutil.rmtree(csdir) | ||
753 | 329 | self.copy_to_target('/etc/console-setup', '/etc/console-setup') | ||
754 | 330 | self.copy_to_target('/etc/default/console-setup', '/etc/default/console-setup') | ||
755 | 331 | self.copy_to_target('/etc/timezone', '/etc/timezone') | ||
756 | 332 | self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'tzdata') | ||
757 | 333 | self.run_in_target('locale-gen', 'en_US.UTF-8') | ||
758 | 334 | if self.vm.lang: | ||
759 | 335 | self.run_in_target('locale-gen', self.vm.lang) | ||
760 | 336 | self.install_from_template('/etc/default/locale', 'locale', { 'lang' : self.vm.lang }) | ||
761 | 337 | self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'locales') | ||
762 | 338 | if have_cs: | ||
763 | 339 | self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'console-setup') | ||
764 | 340 | |||
765 | 341 | def install_vmbuilder_log(self, logfile, rootdir): | ||
766 | 342 | shutil.copy(logfile, '%s/var/log/vmbuilder-install.log' % (rootdir,)) | ||
767 | 0 | 343 | ||
768 | === added directory 'VMBuilder/plugins/debian/templates' | |||
769 | === added file 'VMBuilder/plugins/debian/templates/devicemap.tmpl' | |||
770 | --- VMBuilder/plugins/debian/templates/devicemap.tmpl 1970-01-01 00:00:00 +0000 | |||
771 | +++ VMBuilder/plugins/debian/templates/devicemap.tmpl 2009-06-02 11:01:44 +0000 | |||
772 | @@ -0,0 +1,3 @@ | |||
773 | 1 | #for $disk in $disks | ||
774 | 2 | $disk.get_grub_id() /dev/$prefix$disk.devletters() | ||
775 | 3 | #end for | ||
776 | 0 | 4 | ||
777 | === added file 'VMBuilder/plugins/debian/templates/etc_hosts.tmpl' | |||
778 | --- VMBuilder/plugins/debian/templates/etc_hosts.tmpl 1970-01-01 00:00:00 +0000 | |||
779 | +++ VMBuilder/plugins/debian/templates/etc_hosts.tmpl 2009-06-02 11:01:44 +0000 | |||
780 | @@ -0,0 +1,10 @@ | |||
781 | 1 | 127.0.0.1 localhost | ||
782 | 2 | 127.0.1.1 $hostname.$domain $hostname | ||
783 | 3 | |||
784 | 4 | # The following lines are desirable for IPv6 capable hosts | ||
785 | 5 | ::1 ip6-localhost ip6-loopback | ||
786 | 6 | fe00::0 ip6-localnet | ||
787 | 7 | ff00::0 ip6-mcastprefix | ||
788 | 8 | ff02::1 ip6-allnodes | ||
789 | 9 | ff02::2 ip6-allrouters | ||
790 | 10 | ff02::3 ip6-allhosts | ||
791 | 0 | 11 | ||
792 | === added file 'VMBuilder/plugins/debian/templates/etch_fstab.tmpl' | |||
793 | --- VMBuilder/plugins/debian/templates/etch_fstab.tmpl 1970-01-01 00:00:00 +0000 | |||
794 | +++ VMBuilder/plugins/debian/templates/etch_fstab.tmpl 2009-06-02 11:03:02 +0000 | |||
795 | @@ -0,0 +1,10 @@ | |||
796 | 1 | # /etc/fstab: static file system information. | ||
797 | 2 | # | ||
798 | 3 | # <file system> <mount point> <type> <options> <dump> <pass> | ||
799 | 4 | proc /proc proc defaults 0 0 | ||
800 | 5 | #for $part in $parts | ||
801 | 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) | ||
802 | 7 | #* | ||
803 | 8 | echo "/dev/$prefix$part.get_suffix() $part.mntpnt $part.fs.fstab_fstype() $part.fs.fstab_options() 0 0 | ||
804 | 9 | *# | ||
805 | 10 | #end for | ||
806 | 0 | 11 | ||
807 | === added file 'VMBuilder/plugins/debian/templates/etch_fstab_fsimage.tmpl' | |||
808 | --- VMBuilder/plugins/debian/templates/etch_fstab_fsimage.tmpl 1970-01-01 00:00:00 +0000 | |||
809 | +++ VMBuilder/plugins/debian/templates/etch_fstab_fsimage.tmpl 2009-06-02 11:03:02 +0000 | |||
810 | @@ -0,0 +1,10 @@ | |||
811 | 1 | # /etc/fstab: static file system information. | ||
812 | 2 | # | ||
813 | 3 | # <file system> <mount point> <type> <options> <dump> <pass> | ||
814 | 4 | proc /proc proc defaults 0 0 | ||
815 | 5 | #for $fs in $fss | ||
816 | 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) | ||
817 | 7 | #* | ||
818 | 8 | echo "/dev/$prefix$part.get_suffix() $part.mntpnt $part.fs.fstab_fstype() $part.fs.fstab_options() 0 0 | ||
819 | 9 | *# | ||
820 | 10 | #end for | ||
821 | 0 | 11 | ||
822 | === added file 'VMBuilder/plugins/debian/templates/interfaces.tmpl' | |||
823 | --- VMBuilder/plugins/debian/templates/interfaces.tmpl 1970-01-01 00:00:00 +0000 | |||
824 | +++ VMBuilder/plugins/debian/templates/interfaces.tmpl 2009-06-02 11:01:44 +0000 | |||
825 | @@ -0,0 +1,22 @@ | |||
826 | 1 | # This file describes the network interfaces available on your system | ||
827 | 2 | # and how to activate them. For more information, see interfaces(5). | ||
828 | 3 | |||
829 | 4 | # The loopback network interface | ||
830 | 5 | auto lo | ||
831 | 6 | iface lo inet loopback | ||
832 | 7 | |||
833 | 8 | # The primary network interface | ||
834 | 9 | auto eth0 | ||
835 | 10 | #if $ip == 'dhcp' | ||
836 | 11 | iface eth0 inet dhcp | ||
837 | 12 | #else | ||
838 | 13 | iface eth0 inet static | ||
839 | 14 | address $ip | ||
840 | 15 | netmask $mask | ||
841 | 16 | network $net | ||
842 | 17 | broadcast $bcast | ||
843 | 18 | gateway $gw | ||
844 | 19 | # dns-* options are implemented by the resolvconf package, if installed | ||
845 | 20 | dns-nameservers $dns | ||
846 | 21 | dns-search $domain | ||
847 | 22 | #end if | ||
848 | 0 | 23 | ||
849 | === added file 'VMBuilder/plugins/debian/templates/kernelimg.tmpl' | |||
850 | --- VMBuilder/plugins/debian/templates/kernelimg.tmpl 1970-01-01 00:00:00 +0000 | |||
851 | +++ VMBuilder/plugins/debian/templates/kernelimg.tmpl 2009-06-02 11:01:44 +0000 | |||
852 | @@ -0,0 +1,8 @@ | |||
853 | 1 | do_symlinks = yes | ||
854 | 2 | relative_links = yes | ||
855 | 3 | do_bootfloppy = no | ||
856 | 4 | do_initrd = yes | ||
857 | 5 | link_in_boot = no | ||
858 | 6 | postinst_hook = $updategrub | ||
859 | 7 | postrm_hook = $updategrub | ||
860 | 8 | do_bootloader = no | ||
861 | 0 | 9 | ||
862 | === added file 'VMBuilder/plugins/debian/templates/locale.tmpl' | |||
863 | --- VMBuilder/plugins/debian/templates/locale.tmpl 1970-01-01 00:00:00 +0000 | |||
864 | +++ VMBuilder/plugins/debian/templates/locale.tmpl 2009-06-02 11:01:44 +0000 | |||
865 | @@ -0,0 +1,1 @@ | |||
866 | 1 | LANG="$lang" | ||
867 | 0 | 2 | ||
868 | === added file 'VMBuilder/plugins/debian/templates/nostart-policy-rc.d.tmpl' | |||
869 | --- VMBuilder/plugins/debian/templates/nostart-policy-rc.d.tmpl 1970-01-01 00:00:00 +0000 | |||
870 | +++ VMBuilder/plugins/debian/templates/nostart-policy-rc.d.tmpl 2009-06-02 11:01:44 +0000 | |||
871 | @@ -0,0 +1,18 @@ | |||
872 | 1 | #!/bin/sh | ||
873 | 2 | |||
874 | 3 | while true; do | ||
875 | 4 | case "$1" in | ||
876 | 5 | -*) | ||
877 | 6 | shift | ||
878 | 7 | ;; | ||
879 | 8 | makedev) | ||
880 | 9 | exit 0 | ||
881 | 10 | ;; | ||
882 | 11 | x11-common) | ||
883 | 12 | exit 0 | ||
884 | 13 | ;; | ||
885 | 14 | *) | ||
886 | 15 | exit 101 | ||
887 | 16 | ;; | ||
888 | 17 | esac | ||
889 | 18 | done | ||
890 | 0 | 19 | ||
891 | === added file 'VMBuilder/plugins/debian/templates/sources.list.tmpl' | |||
892 | --- VMBuilder/plugins/debian/templates/sources.list.tmpl 1970-01-01 00:00:00 +0000 | |||
893 | +++ VMBuilder/plugins/debian/templates/sources.list.tmpl 2009-06-04 12:26:50 +0000 | |||
894 | @@ -0,0 +1,6 @@ | |||
895 | 1 | deb $mirror $suite #slurp | ||
896 | 2 | #echo ' '.join($components) | ||
897 | 3 | |||
898 | 4 | deb $security_mirror $suite/updates #slurp | ||
899 | 5 | #echo ' '.join($components) | ||
900 | 6 | |||
901 | 0 | 7 | ||
902 | === added file 'VMBuilder/plugins/debian/templates/sudoers.tmpl' | |||
903 | --- VMBuilder/plugins/debian/templates/sudoers.tmpl 1970-01-01 00:00:00 +0000 | |||
904 | +++ VMBuilder/plugins/debian/templates/sudoers.tmpl 2009-06-03 09:40:36 +0000 | |||
905 | @@ -0,0 +1,33 @@ | |||
906 | 1 | # sudoers file. | ||
907 | 2 | # | ||
908 | 3 | # This file MUST be edited with the 'visudo' command as root. | ||
909 | 4 | # Failure to use 'visudo' may result in syntax or file permission errors | ||
910 | 5 | # that prevent sudo from running. | ||
911 | 6 | # | ||
912 | 7 | # See the sudoers man page for the details on how to write a sudoers file. | ||
913 | 8 | # | ||
914 | 9 | |||
915 | 10 | # Defaults syslog=auth, secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin" | ||
916 | 11 | |||
917 | 12 | # Host alias specification | ||
918 | 13 | |||
919 | 14 | # User alias specification | ||
920 | 15 | |||
921 | 16 | # Cmnd alias specification | ||
922 | 17 | |||
923 | 18 | # Defaults specification | ||
924 | 19 | |||
925 | 20 | # Runas alias specification | ||
926 | 21 | |||
927 | 22 | # User privilege specification | ||
928 | 23 | root ALL=(ALL) ALL | ||
929 | 24 | |||
930 | 25 | # Uncomment to allow people in group wheel to run all commands | ||
931 | 26 | # %wheel ALL=(ALL) ALL | ||
932 | 27 | |||
933 | 28 | # Same thing without a password | ||
934 | 29 | # %wheel ALL=(ALL) NOPASSWD: ALL | ||
935 | 30 | |||
936 | 31 | # Samples | ||
937 | 32 | # %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom | ||
938 | 33 | # %users localhost=/sbin/shutdown -h now | ||
939 | 0 | 34 | ||
940 | === modified file 'VMBuilder/plugins/ubuntu/dapper.py' | |||
941 | --- VMBuilder/plugins/ubuntu/dapper.py 2009-05-07 21:00:20 +0000 | |||
942 | +++ VMBuilder/plugins/ubuntu/dapper.py 2009-06-02 10:32:59 +0000 | |||
943 | @@ -20,12 +20,12 @@ | |||
944 | 20 | import glob | 20 | import glob |
945 | 21 | import logging | 21 | import logging |
946 | 22 | import os | 22 | import os |
947 | 23 | import suite | ||
948 | 24 | import shutil | 23 | import shutil |
949 | 25 | import socket | 24 | import socket |
950 | 26 | import tempfile | 25 | import tempfile |
951 | 27 | import VMBuilder | 26 | import VMBuilder |
952 | 28 | import VMBuilder.disk as disk | 27 | import VMBuilder.disk as disk |
953 | 28 | import VMBuilder.suite as suite | ||
954 | 29 | from VMBuilder.util import run_cmd | 29 | from VMBuilder.util import run_cmd |
955 | 30 | 30 | ||
956 | 31 | class Dapper(suite.Suite): | 31 | class Dapper(suite.Suite): |
957 | 32 | 32 | ||
958 | === modified file 'VMBuilder/plugins/ubuntu/edgy.py' | |||
959 | --- VMBuilder/plugins/ubuntu/edgy.py 2009-05-04 13:08:30 +0000 | |||
960 | +++ VMBuilder/plugins/ubuntu/edgy.py 2009-06-02 10:32:59 +0000 | |||
961 | @@ -18,10 +18,10 @@ | |||
962 | 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/>. |
963 | 19 | # | 19 | # |
964 | 20 | import logging | 20 | import logging |
965 | 21 | import suite | ||
966 | 22 | import shutil | 21 | import shutil |
967 | 23 | import os | 22 | import os |
968 | 24 | import VMBuilder.disk as disk | 23 | import VMBuilder.disk as disk |
969 | 24 | import VMBuilder.suite as suite | ||
970 | 25 | from VMBuilder.util import run_cmd | 25 | from VMBuilder.util import run_cmd |
971 | 26 | from VMBuilder.plugins.ubuntu.dapper import Dapper | 26 | from VMBuilder.plugins.ubuntu.dapper import Dapper |
972 | 27 | 27 | ||
973 | 28 | 28 | ||
974 | === modified file 'VMBuilder/plugins/ubuntu/feisty.py' | |||
975 | --- VMBuilder/plugins/ubuntu/feisty.py 2008-08-29 22:14:45 +0000 | |||
976 | +++ VMBuilder/plugins/ubuntu/feisty.py 2009-06-02 10:32:59 +0000 | |||
977 | @@ -18,8 +18,8 @@ | |||
978 | 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/>. |
979 | 19 | # | 19 | # |
980 | 20 | import logging | 20 | import logging |
981 | 21 | import suite | ||
982 | 22 | import VMBuilder.disk as disk | 21 | import VMBuilder.disk as disk |
983 | 22 | import VMBuilder.suite as suite | ||
984 | 23 | from VMBuilder.util import run_cmd | 23 | from VMBuilder.util import run_cmd |
985 | 24 | from VMBuilder.plugins.ubuntu.edgy import Edgy | 24 | from VMBuilder.plugins.ubuntu.edgy import Edgy |
986 | 25 | 25 | ||
987 | 26 | 26 | ||
988 | === modified file 'VMBuilder/plugins/ubuntu/gutsy.py' | |||
989 | --- VMBuilder/plugins/ubuntu/gutsy.py 2008-11-03 18:23:47 +0000 | |||
990 | +++ VMBuilder/plugins/ubuntu/gutsy.py 2009-06-02 10:32:59 +0000 | |||
991 | @@ -18,8 +18,8 @@ | |||
992 | 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/>. |
993 | 19 | # | 19 | # |
994 | 20 | import logging | 20 | import logging |
995 | 21 | import suite | ||
996 | 22 | import VMBuilder.disk as disk | 21 | import VMBuilder.disk as disk |
997 | 22 | import VMBuilder.suite as suite | ||
998 | 23 | from VMBuilder.util import run_cmd | 23 | from VMBuilder.util import run_cmd |
999 | 24 | from VMBuilder.plugins.ubuntu.feisty import Feisty | 24 | from VMBuilder.plugins.ubuntu.feisty import Feisty |
1000 | 25 | 25 | ||
1001 | 26 | 26 | ||
1002 | === modified file 'VMBuilder/plugins/ubuntu/hardy.py' | |||
1003 | --- VMBuilder/plugins/ubuntu/hardy.py 2008-11-06 15:36:18 +0000 | |||
1004 | +++ VMBuilder/plugins/ubuntu/hardy.py 2009-06-02 10:32:59 +0000 | |||
1005 | @@ -17,7 +17,7 @@ | |||
1006 | 17 | # You should have received a copy of the GNU General Public License | 17 | # You should have received a copy of the GNU General Public License |
1007 | 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/>. |
1008 | 19 | # | 19 | # |
1010 | 20 | import suite | 20 | import VMBuilder.suite as suite |
1011 | 21 | from VMBuilder.plugins.ubuntu.gutsy import Gutsy | 21 | from VMBuilder.plugins.ubuntu.gutsy import Gutsy |
1012 | 22 | 22 | ||
1013 | 23 | class Hardy(Gutsy): | 23 | class Hardy(Gutsy): |
1014 | 24 | 24 | ||
1015 | === modified file 'VMBuilder/plugins/ubuntu/intrepid.py' | |||
1016 | --- VMBuilder/plugins/ubuntu/intrepid.py 2009-02-17 14:39:16 +0000 | |||
1017 | +++ VMBuilder/plugins/ubuntu/intrepid.py 2009-06-02 10:32:59 +0000 | |||
1018 | @@ -17,9 +17,9 @@ | |||
1019 | 17 | # You should have received a copy of the GNU General Public License | 17 | # You should have received a copy of the GNU General Public License |
1020 | 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/>. |
1021 | 19 | # | 19 | # |
1022 | 20 | import suite | ||
1023 | 21 | import logging | 20 | import logging |
1024 | 22 | import VMBuilder.disk as disk | 21 | import VMBuilder.disk as disk |
1025 | 22 | import VMBuilder.suite as suite | ||
1026 | 23 | from VMBuilder.util import run_cmd | 23 | from VMBuilder.util import run_cmd |
1027 | 24 | from VMBuilder.plugins.ubuntu.hardy import Hardy | 24 | from VMBuilder.plugins.ubuntu.hardy import Hardy |
1028 | 25 | 25 | ||
1029 | 26 | 26 | ||
1030 | === modified file 'VMBuilder/plugins/ubuntu/jaunty.py' | |||
1031 | --- VMBuilder/plugins/ubuntu/jaunty.py 2009-05-07 21:00:20 +0000 | |||
1032 | +++ VMBuilder/plugins/ubuntu/jaunty.py 2009-06-02 10:32:59 +0000 | |||
1033 | @@ -17,9 +17,9 @@ | |||
1034 | 17 | # You should have received a copy of the GNU General Public License | 17 | # You should have received a copy of the GNU General Public License |
1035 | 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/>. |
1036 | 19 | # | 19 | # |
1037 | 20 | import suite | ||
1038 | 21 | import logging | 20 | import logging |
1039 | 22 | import VMBuilder.disk as disk | 21 | import VMBuilder.disk as disk |
1040 | 22 | import VMBuilder.suite as suite | ||
1041 | 23 | from VMBuilder.util import run_cmd | 23 | from VMBuilder.util import run_cmd |
1042 | 24 | from VMBuilder.plugins.ubuntu.intrepid import Intrepid | 24 | from VMBuilder.plugins.ubuntu.intrepid import Intrepid |
1043 | 25 | 25 | ||
1044 | 26 | 26 | ||
1045 | === modified file 'VMBuilder/plugins/virtualbox/templates/vm_deploy_script.tmpl' | |||
1046 | --- VMBuilder/plugins/virtualbox/templates/vm_deploy_script.tmpl 2009-04-25 14:45:26 +0000 | |||
1047 | +++ VMBuilder/plugins/virtualbox/templates/vm_deploy_script.tmpl 2009-06-04 23:13:01 +0000 | |||
1048 | @@ -12,12 +12,14 @@ | |||
1049 | 12 | 12 | ||
1050 | 13 | 13 | ||
1051 | 14 | #if $os_type == "ubuntu" | 14 | #if $os_type == "ubuntu" |
1053 | 15 | os_type = "Ubuntu" | 15 | os_type="Ubuntu" |
1054 | 16 | #elif $os_type == "debian" | ||
1055 | 17 | os_type="Debian" | ||
1056 | 16 | #else | 18 | #else |
1058 | 17 | os_type = "Other" | 19 | os_type="Unknown" |
1059 | 18 | #end if | 20 | #end if |
1060 | 19 | 21 | ||
1062 | 20 | disk_path = "#echo os.path.abspath(os.path.dirname($vm_disks[0]))/"# | 22 | disk_path = "#echo os.path.abspath(os.path.dirname($vm_disks[0]))#/" |
1063 | 21 | 23 | ||
1064 | 22 | 24 | ||
1065 | 23 | VBoxManage createvm -name $vm_name -ostype \$os_type -register | 25 | VBoxManage createvm -name $vm_name -ostype \$os_type -register |
1066 | @@ -54,7 +56,7 @@ | |||
1067 | 54 | #end if | 56 | #end if |
1068 | 55 | 57 | ||
1069 | 56 | #if $ip | 58 | #if $ip |
1071 | 57 | #if $ip == dhcp | 59 | #if $ip == "dhcp" |
1072 | 58 | VBoxManage modifyvm $vm_name -nic1 nat | 60 | VBoxManage modifyvm $vm_name -nic1 nat |
1073 | 59 | #else | 61 | #else |
1074 | 60 | VBoxManage modifyvm $vm_name -nic1 intnet | 62 | VBoxManage modifyvm $vm_name -nic1 intnet |
1075 | 61 | 63 | ||
1076 | === modified file 'VMBuilder/plugins/virtualbox/vm.py' | |||
1077 | --- VMBuilder/plugins/virtualbox/vm.py 2009-05-05 08:21:10 +0000 | |||
1078 | +++ VMBuilder/plugins/virtualbox/vm.py 2009-06-04 23:13:42 +0000 | |||
1079 | @@ -19,14 +19,11 @@ | |||
1080 | 19 | # | 19 | # |
1081 | 20 | 20 | ||
1082 | 21 | import os | 21 | import os |
1083 | 22 | import os.path | ||
1084 | 23 | import stat | 22 | import stat |
1085 | 24 | import VMBuilder | ||
1086 | 25 | from VMBuilder import register_hypervisor, Hypervisor, VMBuilderUserError | ||
1087 | 26 | from VMBuilder.disk import vbox_manager_path | ||
1088 | 27 | import VMBuilder.hypervisor | 23 | import VMBuilder.hypervisor |
1089 | 24 | from VMBuilder import register_hypervisor | ||
1090 | 28 | 25 | ||
1092 | 29 | class VirtualBox(Hypervisor): | 26 | class VirtualBox(VMBuilder.hypervisor.Hypervisor): |
1093 | 30 | preferred_storage = VMBuilder.hypervisor.STORAGE_DISK_IMAGE | 27 | preferred_storage = VMBuilder.hypervisor.STORAGE_DISK_IMAGE |
1094 | 31 | needs_bootloader = True | 28 | needs_bootloader = True |
1095 | 32 | name = 'VirtualBox' | 29 | name = 'VirtualBox' |
1096 | 33 | 30 | ||
1097 | === renamed file 'VMBuilder/plugins/ubuntu/suite.py' => 'VMBuilder/suite.py' | |||
1098 | === modified file 'VMBuilder/vm.py' | |||
1099 | --- VMBuilder/vm.py 2009-05-07 14:09:08 +0000 | |||
1100 | +++ VMBuilder/vm.py 2009-06-04 01:11:24 +0000 | |||
1101 | @@ -301,7 +301,7 @@ | |||
1102 | 301 | if (ipclass > 0) and (ipclass <= 127): | 301 | if (ipclass > 0) and (ipclass <= 127): |
1103 | 302 | mask = 0xFF | 302 | mask = 0xFF |
1104 | 303 | elif (ipclass > 128) and (ipclass < 192): | 303 | elif (ipclass > 128) and (ipclass < 192): |
1106 | 304 | mask = OxFFFF | 304 | mask = 0xFFFF |
1107 | 305 | elif (ipclass < 224): | 305 | elif (ipclass < 224): |
1108 | 306 | mask = 0xFFFFFF | 306 | mask = 0xFFFFFF |
1109 | 307 | else: | 307 | else: |
1110 | 308 | 308 | ||
1111 | === added file 'debian-vm-builder' | |||
1112 | --- debian-vm-builder 1970-01-01 00:00:00 +0000 | |||
1113 | +++ debian-vm-builder 2009-06-03 14:54:47 +0000 | |||
1114 | @@ -0,0 +1,29 @@ | |||
1115 | 1 | #!/usr/bin/python | ||
1116 | 2 | # | ||
1117 | 3 | # Uncomplicated VM Builder | ||
1118 | 4 | # Copyright (C) 2007-2008 Canonical Ltd. | ||
1119 | 5 | # | ||
1120 | 6 | # See AUTHORS for list of contributors | ||
1121 | 7 | # | ||
1122 | 8 | # This program is free software: you can redistribute it and/or modify | ||
1123 | 9 | # it under the terms of the GNU General Public License as published by | ||
1124 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
1125 | 11 | # (at your option) any later version. | ||
1126 | 12 | # | ||
1127 | 13 | # This program is distributed in the hope that it will be useful, | ||
1128 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1129 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1130 | 16 | # GNU General Public License for more details. | ||
1131 | 17 | # | ||
1132 | 18 | # You should have received a copy of the GNU General Public License | ||
1133 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1134 | 20 | # | ||
1135 | 21 | |||
1136 | 22 | #import sys | ||
1137 | 23 | #import os | ||
1138 | 24 | #sys.path += [os.getcwd()] | ||
1139 | 25 | |||
1140 | 26 | import VMBuilder | ||
1141 | 27 | |||
1142 | 28 | VMBuilder.set_frontend('ubuntu-vm-builder') | ||
1143 | 29 | VMBuilder.run() | ||
1144 | 0 | 30 | ||
1145 | === added file 'debian-vm-builder.1' | |||
1146 | --- debian-vm-builder.1 1970-01-01 00:00:00 +0000 | |||
1147 | +++ debian-vm-builder.1 2009-06-03 14:54:47 +0000 | |||
1148 | @@ -0,0 +1,7 @@ | |||
1149 | 1 | .TH DEBIAN-VM-BUILDER 1 "Jun 2009" | ||
1150 | 2 | .SH NAME | ||
1151 | 3 | debian-vm-builder \- builds virtual machines from the command line | ||
1152 | 4 | .SH DESCRIPTION | ||
1153 | 5 | debian-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 | ||
1154 | 6 | .B vmbuilder <hypervisor> <distro> --help | ||
1155 | 7 | for a full list of options. | ||
1156 | 0 | 8 | ||
1157 | === modified file 'setup.py' | |||
1158 | --- setup.py 2009-02-23 14:04:47 +0000 | |||
1159 | +++ setup.py 2009-06-03 20:46:16 +0000 | |||
1160 | @@ -1,3 +1,5 @@ | |||
1161 | 1 | #!/usr/bin/python | ||
1162 | 2 | |||
1163 | 1 | from distutils.core import setup | 3 | from distutils.core import setup |
1164 | 2 | import VMBuilder.plugins | 4 | import VMBuilder.plugins |
1165 | 3 | from glob import glob | 5 | from glob import glob |
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...