Merge lp:~r.kintzi/vmbuilder/existing-chroot into lp:vmbuilder

Proposed by Radosław Kintzi
Status: Merged
Merged at revision: 462
Proposed branch: lp:~r.kintzi/vmbuilder/existing-chroot
Merge into: lp:vmbuilder
Diff against target: 52 lines (+9/-1)
2 files modified
VMBuilder/contrib/cli.py (+8/-0)
VMBuilder/plugins/ubuntu/distro.py (+1/-1)
To merge this branch: bzr merge lp:~r.kintzi/vmbuilder/existing-chroot
Reviewer Review Type Date Requested Status
Serge Hallyn Approve
Review via email: mp+45398@code.launchpad.net

Description of the change

- new --chroot-dir option to build chroot in specific directory (usefull wiht --only-chroot)
- /etc/hostname and /etc/hosts files are now generated at image build stage not at bootstrap (just like /etc/network/interfaces); This allows to use chroots (previously built with --only-chroot option) as templates for disk images

To post a comment you must log in.
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'VMBuilder/contrib/cli.py'
2--- VMBuilder/contrib/cli.py 2010-07-09 21:48:56 +0000
3+++ VMBuilder/contrib/cli.py 2011-01-06 15:33:14 +0000
4@@ -78,6 +78,8 @@
5 action='store_true',
6 help=("Only build the chroot. Don't install it "
7 "on disk images or anything."))
8+ group.add_option('--chroot-dir',
9+ help="Build the chroot in directory.")
10 group.add_option('--existing-chroot',
11 help="Use existing chroot.")
12 group.add_option('--tmp',
13@@ -155,6 +157,9 @@
14 destdir = self.options.destdir or ('%s-%s' % (distro.arg,
15 hypervisor.arg))
16
17+ if self.options.tmpfs and self.options.chroot_dir:
18+ raise VMBuilderUserError('--chroot-dir and --tmpfs can not be used together.')
19+
20 if os.path.exists(destdir):
21 if self.options.overwrite:
22 logging.debug('%s existed, but -o was specified. '
23@@ -202,6 +207,9 @@
24 tmpfs_mount_point = util.set_up_tmpfs(
25 tmp_root=self.options.tmp_root, size=tmpfs_size)
26 chroot_dir = tmpfs_mount_point
27+ elif self.options.chroot_dir:
28+ os.mkdir(self.options.chroot_dir)
29+ chroot_dir = self.options.chroot_dir
30 else:
31 chroot_dir = util.tmpdir(tmp_root=self.options.tmp_root)
32 distro.set_chroot_dir(chroot_dir)
33
34=== modified file 'VMBuilder/plugins/ubuntu/distro.py'
35--- VMBuilder/plugins/ubuntu/distro.py 2010-11-16 16:32:47 +0000
36+++ VMBuilder/plugins/ubuntu/distro.py 2011-01-06 15:33:14 +0000
37@@ -144,7 +144,6 @@
38 self.suite.install_extras()
39 self.suite.create_initial_user()
40 self.suite.install_authorized_keys()
41- self.suite.config_host_and_domainname()
42 self.suite.set_timezone()
43 self.suite.set_locale()
44 self.suite.update()
45@@ -158,6 +157,7 @@
46 self.suite.create_manifest()
47
48 def configure_networking(self, nics):
49+ self.suite.config_host_and_domainname()
50 self.suite.config_interfaces(nics)
51
52 def configure_mounting(self, disks, filesystems):

Subscribers

People subscribed via source and target branches