summaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2012-09-14 15:35:37 +0200
committerTails developers <amnesia@boum.org>2012-09-14 15:37:46 +0200
commitce064bee4deb07a6b42eaed6af716cbe0b865f33 (patch)
treeec66e95d2ca4101fba28d96d001ed54a586ca860 /Rakefile
parente347c817ca56277991d888a4303f3a2f5fc065e1 (diff)
vagrant: Allow in-memory builds when a VM with enough memory is already started
There is already another check in 'vm:up' to be sure that the VM has enough memory to perform the build.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile9
1 files changed, 8 insertions, 1 deletions
diff --git a/Rakefile b/Rakefile
index 03d57f0..6e2ea99 100644
--- a/Rakefile
+++ b/Rakefile
@@ -55,6 +55,11 @@ def current_vm_cpus
$1.to_i if info =~ /^cpus=(\d+)/
end
+def vm_running?
+ env = Vagrant::Environment.new(:cwd => VAGRANT_PATH, :ui_class => Vagrant::UI::Basic)
+ env.primary_vm.state == :running
+end
+
def enough_free_memory?
return false unless RbConfig::CONFIG['host_os'] =~ /linux/i
@@ -106,7 +111,9 @@ task :parse_build_options do
case opt
# Memory build settings
when 'ram'
- abort "Not enough free memory to do an in-memory build. Aborting." unless enough_free_memory?
+ unless vm_running? || enough_free_memory?
+ abort "Not enough free memory to do an in-memory build. Aborting."
+ end
ENV['TAILS_RAM_BUILD'] = '1'
when 'noram'
ENV['TAILS_RAM_BUILD'] = nil