diff --git a/BOXES.md b/BOXES.md index 10ebde3..5f51ef6 100644 --- a/BOXES.md +++ b/BOXES.md @@ -52,5 +52,5 @@ on knowing what makes a base box for vagrant-lxc, here's what's needed: | --- | --- | --- | | `provider` | Yes | Required by Vagrant | | `version` | Yes | Tracks backward incompatibilities | -| `built-on` | No | Date / time when the box was packaged | +| `built-on` | No | Date / time when the box was packaged for the first time | | `template-opts` | No | Extra options to be passed to the `lxc-template` script provided with the .box package | diff --git a/lib/vagrant-lxc/action/setup_package_files.rb b/lib/vagrant-lxc/action/setup_package_files.rb index a770604..0132035 100644 --- a/lib/vagrant-lxc/action/setup_package_files.rb +++ b/lib/vagrant-lxc/action/setup_package_files.rb @@ -45,10 +45,12 @@ module Vagrant box_dir = @env[:machine].box.directory FileUtils.cp box_dir.join('lxc-template').to_s, @env['package.directory'].to_s FileUtils.cp box_dir.join('metadata.json').to_s, @env['package.directory'].to_s - # TODO: Update built-on metadata.json if (conf = box_dir.join('lxc.conf')).exist? FileUtils.cp conf.to_s, @env['package.directory'].to_s end + if (conf = box_dir.join('lxc-config')).exist? + FileUtils.cp conf.to_s, @env['package.directory'].to_s + end end end end diff --git a/spec/unit/action/setup_package_files_spec.rb b/spec/unit/action/setup_package_files_spec.rb index cf39158..0527acd 100644 --- a/spec/unit/action/setup_package_files_spec.rb +++ b/spec/unit/action/setup_package_files_spec.rb @@ -14,7 +14,7 @@ describe Vagrant::LXC::Action::SetupPackageFiles do before do box.directory.mkdir - files = %w( lxc-template metadata.json lxc.conf ).map { |f| box.directory.join(f) } + files = %w( lxc-template metadata.json lxc.conf lxc-config ).map { |f| box.directory.join(f) } (files + [rootfs_path]).each do |file| file.open('w') { |f| f.puts file.to_s } end @@ -41,6 +41,10 @@ describe Vagrant::LXC::Action::SetupPackageFiles do env['package.directory'].join('lxc-template').should be_file end + it 'copies box lxc-config to package directory' do + env['package.directory'].join('lxc-config').should be_file + end + it 'moves the compressed rootfs to package directory' do env['package.directory'].join(rootfs_path.basename).should be_file env['package.rootfs'].should_not be_file