Merge pull request #131 from hamann/fix_box_compressing
error while compressing container's rootfs
This commit is contained in:
commit
5c6556f08b
1 changed files with 2 additions and 4 deletions
|
@ -100,15 +100,13 @@ module Vagrant
|
||||||
|
|
||||||
# TODO: This needs to be reviewed and specs needs to be written
|
# TODO: This needs to be reviewed and specs needs to be written
|
||||||
def compress_rootfs
|
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
|
# TODO: Pass in tmpdir so we can clean up from outside
|
||||||
target_path = "#{Dir.mktmpdir}/rootfs.tar.gz"
|
target_path = "#{Dir.mktmpdir}/rootfs.tar.gz"
|
||||||
|
|
||||||
Dir.chdir base_path do
|
Dir.chdir base_path do
|
||||||
@logger.info "Compressing '#{rootfs_path}' rootfs to #{target_path}"
|
@logger.info "Compressing '#{rootfs_path}' rootfs to #{target_path}"
|
||||||
@sudo_wrapper.run('rm', '-f', 'rootfs.tar.gz')
|
@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"
|
@logger.info "Changing rootfs tarbal owner"
|
||||||
@sudo_wrapper.run('chown', "#{ENV['USER']}:#{ENV['USER']}", target_path)
|
@sudo_wrapper.run('chown', "#{ENV['USER']}:#{ENV['USER']}", target_path)
|
||||||
|
|
Loading…
Reference in a new issue