Proper base box cleanup

This commit is contained in:
Fabio Rehm 2013-05-06 10:42:30 -03:00
parent 0e066e7a1c
commit 9a731ec989
2 changed files with 8 additions and 7 deletions

View file

@ -1,10 +1,14 @@
## [0.?.?](https://github.com/fgrehm/vagrant-lxc/compare/v0.3.3...master) (unreleased) ## [0.?.?](https://github.com/fgrehm/vagrant-lxc/compare/v0.3.3...master)
FEATURES: FEATURES:
- Support for building Debian boxes (tks to @Val) - Support for building Debian boxes (tks to @Val)
- Support for installing babushka on base boxes (tks to @Val) - Support for installing babushka on base boxes (tks to @Val)
IMPROVEMENTS:
- Clean up base boxes files after they've been configured, resulting in smaller packages
## [0.3.3](https://github.com/fgrehm/vagrant-lxc/compare/v0.3.2...v0.3.3) (April 23, 2013) ## [0.3.3](https://github.com/fgrehm/vagrant-lxc/compare/v0.3.2...v0.3.3) (April 23, 2013)
BUG FIXES: BUG FIXES:

View file

@ -1,3 +1,4 @@
require 'pathname'
require 'rake/tasklib' require 'rake/tasklib'
class BuildGenericBoxTask < ::Rake::TaskLib class BuildGenericBoxTask < ::Rake::TaskLib
@ -55,7 +56,7 @@ class BuildGenericBoxTask < ::Rake::TaskLib
download download
install_cfg_engines install_cfg_engines
prepare_package_contents pwd prepare_package_contents pwd
cleanup sh 'sudo rm -rf rootfs'
sh "tar -czf tmp-package.box ./*" sh "tar -czf tmp-package.box ./*"
end end
@ -93,6 +94,7 @@ class BuildGenericBoxTask < ::Rake::TaskLib
end end
def prepare_package_contents(pwd) def prepare_package_contents(pwd)
run 'cleanup'
sh 'sudo rm -f rootfs.tar.gz' sh 'sudo rm -f rootfs.tar.gz'
sh 'sudo tar --numeric-owner -czf rootfs.tar.gz ./rootfs/*' sh 'sudo tar --numeric-owner -czf rootfs.tar.gz ./rootfs/*'
sh "sudo chown #{ENV['USER']}:#{ENV['USER']} rootfs.tar.gz" sh "sudo chown #{ENV['USER']}:#{ENV['USER']} rootfs.tar.gz"
@ -106,11 +108,6 @@ class BuildGenericBoxTask < ::Rake::TaskLib
metadata.gsub!('RELEASE', @release) metadata.gsub!('RELEASE', @release)
File.open('metadata.json', 'w') { |f| f.print metadata } File.open('metadata.json', 'w') { |f| f.print metadata }
end end
def cleanup
run 'cleanup'
sh 'sudo rm -rf rootfs'
end
end end
class BuildDebianBoxTask < BuildGenericBoxTask class BuildDebianBoxTask < BuildGenericBoxTask