Commit 69792d7b authored by Tails developers's avatar Tails developers
Browse files

vagrant: Add defaults for virtual CPUs build settings

On Linux, we set the number of virtual CPUs to the number of CPUs in host
system.
parent 3c41c911
......@@ -59,6 +59,16 @@ def enough_free_memory?
end
end
def system_cpus
return nil unless RbConfig::CONFIG['host_os'] =~ /linux/i
begin
File.read('/proc/cpuinfo').scan(/^processor\s+:/).count
rescue
nil
end
end
task :parse_build_options do
options = ''
......@@ -68,6 +78,10 @@ task :parse_build_options do
# Use in-VM proxy unless an external proxy is set
options += 'vmproxy ' unless EXTERNAL_HTTP_PROXY
# Default to the number of system CPUs when we can figure it out
cpus = system_cpus
options += "cpus=#{cpus} " if cpus
options += ENV['TAILS_BUILD_OPTIONS'] if ENV['TAILS_BUILD_OPTIONS']
options.split(' ').each do |opt|
case opt
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment