From 61e7cbce42f7de5a084589b69be02b92486c63b3 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Fri, 30 Aug 2013 18:17:28 -0300 Subject: [PATCH] boxes/ubuntu: create base container --- tasks/boxes.rake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tasks/boxes.rake b/tasks/boxes.rake index 82f7ce4..84fd25e 100644 --- a/tasks/boxes.rake +++ b/tasks/boxes.rake @@ -43,9 +43,9 @@ class BuildGenericBoxTask < ::Rake::TaskLib create_base_container(template) do |rootfs| configure_vagrant_user(rootfs) install_cfg_engines(rootfs) + cleanup(rootfs) prepare_package_contents(rootfs) compress_box(rootfs) - cleanup(rootfs) end end end @@ -67,8 +67,11 @@ class BuildGenericBoxTask < ::Rake::TaskLib end def create_base_container(template) - puts "TODO: Create base container with #{template}" - yield "/var/lib/lxc/vagrant-base-box-tmp/rootfs" + container_name = 'vagrant-base-box-tmp' + sh "sudo lxc-create -n #{container_name} -t vagrant-base-box-template -- --arch #{@arch} --release #{@release}" + yield "/var/lib/lxc/#{container_name}/rootfs" + ensure + sh "sudo lxc-destroy -n #{container_name}" end def configure_vagrant_user(rootfs) @@ -92,7 +95,7 @@ class BuildGenericBoxTask < ::Rake::TaskLib end def import_template - template_name = "vagrant-base-box-tmp" + template_name = "vagrant-base-box-template" tmp_template_path = templates_path.join("lxc-#{template_name}") src = "./boxes/templates/#{@distrib}"