From 280702061d6cd05d9399512ed3ce65e3e402ea9d Mon Sep 17 00:00:00 2001 From: Holger Amann Date: Sun, 11 Aug 2013 15:30:23 +0200 Subject: [PATCH] fix creating rootfs.tar.gz --- lib/vagrant-lxc/driver.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index 9b6b612..dc4e216 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -100,16 +100,14 @@ module Vagrant # TODO: This needs to be reviewed and specs needs to be written def compress_rootfs - rootfs_dirname = File.dirname rootfs_path - basename = rootfs_path.to_s.gsub(/^#{Regexp.escape rootfs_dirname}\//, '') # TODO: Pass in tmpdir so we can clean up from outside target_path = "#{Dir.mktmpdir}/rootfs.tar.gz" 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, "#{basename}/*") - + @sudo_wrapper.run('tar', '--numeric-owner', '-czf', target_path, '-C', rootfs_path.to_s, '.') + @logger.info "Changing rootfs tarbal owner" @sudo_wrapper.run('chown', "#{ENV['USER']}:#{ENV['USER']}", target_path) end