summaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2012-05-13 21:50:56 +0200
committerTails developers <amnesia@boum.org>2012-05-16 12:53:18 +0200
commit20d07c796492b4d7e4b7a7d5237e1e9d0d414bda (patch)
treedebff10f3c391828c8f2b40984ee56767522c731 /Rakefile
parent5193c435d244417d02e6bf1a6fbda9116a7000b4 (diff)
vagrant: Add build task
We export some environment variables to the build script inside the virtual machine. One of them is http_proxy, so we first validate if it is not set to use a proxy on localhost. In order to properly get output from Vagrant, we handle its replication on stderr/stdout manually.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile16
1 files changed, 16 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index 938e915..031a278 100644
--- a/Rakefile
+++ b/Rakefile
@@ -24,6 +24,9 @@ require 'uri'
# Path to the directory which holds our Vagrantfile
VAGRANT_PATH = File.expand_path('../vagrant', __FILE__)
+# Environment variables that will be exported to the build script
+EXPORTED_VARIABLES = ['http_proxy', 'MKSQUASHFS_OPTIONS']
+
task :validate_http_proxy do
if ENV['http_proxy']
proxy_host = URI.parse(ENV['http_proxy']).host
@@ -38,6 +41,19 @@ task :validate_http_proxy do
end
end
+desc 'Build Tails'
+task :build => ['validate_http_proxy', 'vm:up'] do
+ exported_env = EXPORTED_VARIABLES.select { |k| ENV[k] }.
+ collect { |k| "#{k}='#{ENV[k]}'" }.join(' ')
+
+ env = Vagrant::Environment.new(:cwd => VAGRANT_PATH)
+ status = env.primary_vm.channel.execute("#{exported_env} build-tails",
+ :error_check => false) do |fd, data|
+ (fd == :stdout ? $stdout : $stderr).write data
+ end
+ exit status
+end
+
namespace :vm do
desc 'Start the build virtual machine'
task :up do