From f52835cb58eca7bdc8398b23cf45ccfd763468c5 Mon Sep 17 00:00:00 2001 From: Willem de Groot Date: Wed, 30 Oct 2013 12:01:51 +0100 Subject: [PATCH 1/2] Fix relative path issue used for `vagrant package` --- lib/vagrant-lxc/driver.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index b98ed3e..e455085 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -109,7 +109,7 @@ module Vagrant Dir.chdir base_path do @logger.info "Compressing '#{rootfs_path}' rootfs to #{target_path}" @sudo_wrapper.run('rm', '-f', 'rootfs.tar.gz') - @sudo_wrapper.run('tar', '--numeric-owner', '-czf', target_path, 'rootfs') + @sudo_wrapper.run('tar', '--numeric-owner', '-czf', target_path, './rootfs') @logger.info "Changing rootfs tarball owner" user_details = Etc.getpwnam(Etc.getlogin) From 2790261e58a8dd84c86f5424103dc3d71fe0cc76 Mon Sep 17 00:00:00 2001 From: Willem de Groot Date: Tue, 5 Nov 2013 19:55:41 +0100 Subject: [PATCH 2/2] included rootfs_path variable in tar command --- lib/vagrant-lxc/driver.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index e455085..dc30a85 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -109,7 +109,11 @@ module Vagrant Dir.chdir base_path do @logger.info "Compressing '#{rootfs_path}' rootfs to #{target_path}" @sudo_wrapper.run('rm', '-f', 'rootfs.tar.gz') - @sudo_wrapper.run('tar', '--numeric-owner', '-czf', target_path, './rootfs') + # "vagrant package" will copy the existing lxc-template in the new box file + # To keep this function backwards compatible with existing boxes, the path + # included in the tarball needs to have the same amount of path components (2) + # that will be stripped before extraction, hence the './.' + @sudo_wrapper.run('tar', '--numeric-owner', '-czf', target_path, '-C', "#{rootfs_path}", './.') @logger.info "Changing rootfs tarball owner" user_details = Etc.getpwnam(Etc.getlogin)